Java tutorial
//package com.java2s; import java.net.MalformedURLException; import java.net.URL; public class Main { public static String NEWLINE = "\r\n"; public static String makeGETrequest(String url) throws MalformedURLException { String result = ""; URL requestURL = new URL(url); result += "GET " + requestURL.getFile() + " HTTP/1.1"; result += NEWLINE; result += "Host: " + requestURL.getHost() + ":" + (requestURL.getPort() > 0 ? requestURL.getPort() : 80); result += NEWLINE; result += "Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"; result += NEWLINE; result += "Connection: close"; result += NEWLINE; result += NEWLINE; return result; } }