Here you can find the source of getStringFromUrl(String url)
public static String getStringFromUrl(String url) throws ClientProtocolException, IOException
//package com.java2s; import java.io.IOException; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; public class Main { public static String getStringFromUrl(String url) throws ClientProtocolException, IOException { HttpGet get = new HttpGet(url); HttpClient client = new DefaultHttpClient(); HttpResponse response = client.execute(get); HttpEntity entity = response.getEntity(); return EntityUtils.toString(entity, "UTF-8"); }/*from w w w.jav a 2s .c o m*/ }