Home  >  Article  >  Backend Development  >  PHP gets the proxy server ip used by the user, which is the real ip_PHP tutorial

PHP gets the proxy server ip used by the user, which is the real ip_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:58:571128browse

From http://www.phpchina.com/bbs/thread-12239-1-1.html
Use $_SERVER["REMOTE_ADDR"] in PHP to obtain the client's IP address

But if If the client uses a proxy server to access

, what it gets is the IP address of the proxy server

If you want to get the real IP address of the client through the proxy server

you need to Use $_SERVER["HTTP_X_FORWARDED_FOR"] to read

But not every proxy server can use $_SERVER["HTTP_X_FORWARDED_FOR"] to read the real IP of the client

Some use this What the method reads is still the IP of the proxy server

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317521.htmlTechArticle from http://www.phpchina.com/bbs/thread-12239-1-1.html in PHP Use $_SERVER["REMOTE_ADDR"] to obtain the client's IP address, but if the client uses a proxy server to access it...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn