Skip to content

Instantly share code, notes, and snippets.

@benlieb
Last active December 16, 2015 04:19
Show Gist options
  • Save benlieb/5376060 to your computer and use it in GitHub Desktop.
Save benlieb/5376060 to your computer and use it in GitHub Desktop.
protected HttpURLConnection urlConnection(URL url)
{
HttpURLConnection c;
try
{
c = (HttpURLConnection) url.openConnection();
c.setRequestMethod("GET");
c.setDoOutput(true);
c.connect();
}
catch(MalformedURLException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
return c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment