JRMorris77
12/20/2017 - 7:59 AM

Get True Outgoing IP Address of a Web Server

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;