Home > php教程 > php手册 > PHP获得用户使用的代理服务器ip即真实ip

PHP获得用户使用的代理服务器ip即真实ip

WBOY
Release: 2016-06-13 12:34:58
Original
972 people have browsed it

来自 http://www.phpchina.com/bbs/thread-12239-1-1.html
在PHP 中用 $_SERVER["REMOTE_ADDR"] 来取得客户端的 IP 地址

但如果客户端是使用代理服务器来访问

那取到的就是代理服务器的 IP 地址

要想透过代理服务器取得客户端的真实 IP 地址

就要使用 $_SERVER["HTTP_X_FORWARDED_FOR"] 来读取

但并不是每个代理服务器都能用 $_SERVER["HTTP_X_FORWARDED_FOR"] 来读取客户端的真实 IP

有些用此方法读取到的仍然是代理服务器的 IP 

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template