Java tutorial
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; public class Main { private static HttpURLConnection _openPostConnection(String purl) throws IOException { URL url = new URL(purl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.setUseCaches(false); connection.setDoOutput(true); connection.setRequestMethod("GET"); connection.setRequestProperty("User-Agent", "Android Client Agent"); return connection; } }