java获取网页源代码
public static String getHtmlContent(URL url, String encode) { StringBuffer contentBuffer = new StringBuffer(); int responseCode = -1; HttpURLConnection con = null; try { con = (HttpURLConnection) url.openConnection(); con.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");// IE代理进行下载 con.setConnectTimeout(60000); con.setReadTimeout(60000); // 获得网页返回信息码 responseCode = con.getResponseCode(); if (responseCode == -1) { String re = url.toString() + " : connecti...