Java tutorial
//package com.java2s; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static InputStream getRequest(String path) throws Exception { URL url = new URL(path); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setConnectTimeout(5000); if (conn.getResponseCode() == 200) { return conn.getInputStream(); } return null; } }