Skip to content

Instantly share code, notes, and snippets.

@TomTasche
Created September 15, 2011 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomTasche/1220412 to your computer and use it in GitHub Desktop.
Save TomTasche/1220412 to your computer and use it in GitHub Desktop.
Quick n dirty ifconfig.me call in Java
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://ifconfig.me/ip");
HttpResponse httpResponse = httpClient.execute(httpGet);
System.out.println(new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent())).readLine());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment