标签:blog http io java on 2014 问题 log cti
URL url = new URL("****************"); StringBuffer html = new StringBuffer(); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("User-Agent", "Mozilla/31.0 (compatible; MSIE 10.0; Windows NT; DigExt)"); InputStreamReader isr = new InputStreamReader(conn.getInputStream(),"utf-8");
设一下请求属性就行了:
conn.setRequestProperty("User-Agent", "Mozilla/31.0 (compatible; MSIE 10.0; Windows NT; DigExt)");
标签:blog http io java on 2014 问题 log cti
原文地址:http://blog.csdn.net/honglei_zh/article/details/41382047