Skip to content

Instantly share code, notes, and snippets.

@technosailor
Created January 10, 2014 17:21
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 technosailor/8358491 to your computer and use it in GitHub Desktop.
Save technosailor/8358491 to your computer and use it in GitHub Desktop.
Nothing fancy. Just a way to get your external IP. Useful for dealing with services that you have to have a white listed IP and maybe you have a lot of servers in a cluster and need to know what the external service is seeing. It's like I'm describing my own personal hell right now...
<?php
$json = file_get_contents( 'http://ifconfig.me/all.json' );
$data = json_decode( $json );
echo $data->ip_addr;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment