Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Get True Outgoing IP Address of a Web Server
/*
There are times when you need to find out of the IP address your domain maps to in DNS is the same
as the IP address of your web server's outgoing interface. This is particularly useful when dealing
with APIs such as eNOM. The following just performs a simple query agains http://ipecho.net/plain to
optain your server's outgoing IP. This can be modified with any number of similar services.
*/
$realIP = file_get_contents("http://ipecho.net/plain");
echo $realIP;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment