Created
September 15, 2011 20:40
-
-
Save TomTasche/1220412 to your computer and use it in GitHub Desktop.
Quick n dirty ifconfig.me call in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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