Here you can find the source of downloadPageSource(String stringURL)
public static String downloadPageSource(String stringURL) throws IOException
//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 downloadPageSource(String stringURL) throws IOException { URL url;//from w w w . j ava 2s . c o m HttpURLConnection conn; StringBuilder source = new StringBuilder(); try { url = new URL(stringURL); conn = (HttpURLConnection) url.openConnection(); } catch (IOException ex) { throw ex; } try { String line; conn.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); while ((line = in.readLine()) != null) source.append(line); } catch (IOException ex) { throw ex; } finally { conn.disconnect(); } return source.toString(); } }