Java tutorial
//package com.java2s; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; public class Main { private static HttpURLConnection getConnection(URL url) throws IOException { HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setDoInput(true); conn.setDoOutput(true); conn.setRequestProperty("Accept", "text/xml"); return conn; } }