Here you can find the source of getHtml(String url)
static String getHtml(String url) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class Main { static String getHtml(String url) throws Exception { StringBuilder result = new StringBuilder(); HttpURLConnection conn = (HttpURLConnection) new URL(url) .openConnection();/* w ww .j a va2 s . co m*/ conn.setRequestMethod("GET"); BufferedReader reader = new BufferedReader(new InputStreamReader( conn.getInputStream())); String line; while ((line = reader.readLine()) != null) { result.append(line); } reader.close(); return result.toString(); } }