Here you can find the source of getWebContent(String pvUrl)
public static JSONObject getWebContent(String pvUrl)
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import org.json.JSONException; import org.json.JSONObject; public class Main { public static JSONObject getWebContent(String pvUrl) { URL url = null;//from ww w. j av a 2s . c o m try { url = new URL(pvUrl); } catch (MalformedURLException e) { e.printStackTrace(); } HttpURLConnection conn; JSONObject ret = null; String json = null; try { conn = (HttpURLConnection) url.openConnection(); BufferedReader reader = new BufferedReader( new InputStreamReader(conn.getInputStream())); json = reader.readLine(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { ret = new JSONObject(json); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ret; } }