Here you can find the source of httpGet(String url)
public static byte[] httpGet(String url)
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static byte[] httpGet(String url) { try {//from w w w . ja va2s . com URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("User-Agent", "Mozilla/5.0"); InputStream in = con.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); while (in.available() > 0) out.write(in.read()); in.close(); out.close(); return out.toByteArray(); } catch (IOException e) { e.printStackTrace(); return new byte[] {}; } } }