Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public class Main { public static String retrieveText(String url) throws IOException { BufferedReader stream = new BufferedReader(new InputStreamReader(retrieve(url))); String response = ""; String line; while ((line = stream.readLine()) != null) response += line; return response; } private static InputStream retrieve(String url) throws IOException { URL target = new URL(url); URLConnection connection = target.openConnection(); return connection.getInputStream(); } }