Skip to content

Instantly share code, notes, and snippets.

@WengerK
Last active August 15, 2016 12:07
Show Gist options
  • Save WengerK/460add20a4e3f82ab0d3698e858a297e to your computer and use it in GitHub Desktop.
Save WengerK/460add20a4e3f82ab0d3698e858a297e to your computer and use it in GitHub Desktop.
What's my IP using PHP CLI

What's my IP using PHP CLI

A mechanism for discovering the IP of the computer using PHP CLI

php -r 'echo file_get_contents("http://ip.appspot.com/") . "\n";'
php -r "echo gethostbyname(php_uname('n'));"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment