Here you can find the source of sendGetRequest(String urlStr)
public static String sendGetRequest(String urlStr)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public class Main { public static String sendGetRequest(String urlStr) { try {/* ww w . j av a 2 s .c o m*/ URL url = new URL(urlStr); URLConnection conn = url.openConnection(); BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); StringBuilder sb = new StringBuilder(); String line; while ((line = rd.readLine()) != null) { sb.append(line); } rd.close(); return sb.toString(); } catch (Exception e) { e.printStackTrace(); } return null; } }