Skip to content

Instantly share code, notes, and snippets.

@ehgoodenough
Created February 15, 2015 09:57
Show Gist options
  • Save ehgoodenough/54447ea9e164ce1724fd to your computer and use it in GitHub Desktop.
Save ehgoodenough/54447ea9e164ce1724fd to your computer and use it in GitHub Desktop.
import java.net.URLConnection;
import java.net.URL;
import java.net.MalformedURLException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
public class HTTPtest
{
public static void main(String[] args) throws MalformedURLException, IOException
{
URLConnection connection = new URL("http://leveledup.io/users/andrew/untz").openConnection();
connection.setRequestProperty("Accept-Charset", "UTF-8");
InputStream response = connection.getInputStream();
BufferedReader responseReader = new BufferedReader(new InputStreamReader(response));
System.out.println(responseReader.readLine());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment