转载自:http://blog.csdn.net/rascalboy520/article/details/2503998
?
public static String getHtml(String tempurl,String code){ try{ URL url = new URL(tempurl); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.connect(); InputStream is = conn.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is,code)); String line=""; StringBuffer resultBuffer = new StringBuffer(); while((line = br.readLine())!=null){ resultBuffer.append(line); } br.close(); is.close(); conn.disconnect(); return resultBuffer.toString(); } catch(Exception e){} return null; } 其中,tempurl为指定的url地址, code是指定url页面的页面编码?