Here you can find the source of getHtml(String urlString)
public static String getHtml(String urlString)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static String getHtml(String urlString) { if (urlString.contains("id")) { StringBuilder html = new StringBuilder(); InputStreamReader isr = null; BufferedReader br = null; try { URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); isr = new InputStreamReader(conn.getInputStream()); br = new BufferedReader(isr); String temp;//from www .java2 s. c om while ((temp = br.readLine()) != null) { html.append(temp); } } catch (Exception e) { e.printStackTrace(); return ""; } finally { if (br != null) { try { br.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } if (isr != null) { try { isr.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } } return html.toString(); } else { return ""; } } }