Java tutorial
//package com.java2s; import android.util.Log; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class Main { private static String KEY_LOG = null; public static String stringFromHttpGet(String urlString) { try { URL url = new URL(urlString); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); return response.toString(); } catch (Exception e) { e.printStackTrace(); logError(e.getMessage()); return null; } } public static void logError(String error) { Log.e(KEY_LOG, error); } }