Java Tip: setting a header on a http request
This didn’t actually take me that long to figure out, but I can easily see how it could take someone a while, so I thought I’d include a code snippet for the benefit of our Googling friends:
URL url = new URL(“http://whatever”);
URLConnection urc = url.openConnection();
urc.setRequestProperty(“header”,”header-value”);
urc.connect();
InputStream in = urc.getInputStream();