php 获取Web服务器的真实传出IP地址

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 获取Web服务器的真实传出IP地址相关的知识,希望对你有一定的参考价值。

/* 
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;

以上是关于php 获取Web服务器的真实传出IP地址的主要内容,如果未能解决你的问题,请参考以下文章