Created
December 20, 2017 07:59
-
-
Save JRMorris77/bd285e6cdd4594c3275eddc842b40e83 to your computer and use it in GitHub Desktop.
Get True Outgoing IP Address of a Web Server
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
/* | |
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