Home >Backend Development >PHP Tutorial >PHP implementation detects whether the client uses a proxy server and its anonymity level, php proxy server_PHP tutorial
To determine whether the client uses a proxy server, you can judge from the environment variable information sent by the client.
Specifically, look at the HTTP_VIA field. If this field is set, it means that the client uses a proxy server.
The level of anonymity can be determined by referring to the table below.
Given an application example, you can hang up a proxy and try the effect: http://ip.mixsec.org/
1. Situation without using proxy server:
REMOTE_ADDR = your IP
HTTP_VIA = No value or not displayed
HTTP_X_FORWARDED_FOR = No value or not displayed
2. The use of transparent proxy servers: Transparent Proxies
REMOTE_ADDR = proxy server IP
HTTP_VIA = Proxy server IP (Supplement: This field is filled in by the proxy server, and sometimes gateway information, etc.)
HTTP_X_FORWARDED_FOR = your real IP
This type of proxy server still forwards your information to the person you are visiting, and cannot achieve the purpose of hiding your true identity.
3. The situation of using ordinary anonymous proxy servers: Anonymous Proxies
REMOTE_ADDR = proxy server IP
HTTP_VIA = Proxy server IP (Supplement: This field is filled in by the proxy server, and sometimes gateway information, etc.)
HTTP_X_FORWARDED_FOR = Proxy server IP
Hide your real IP, but reveal to the target that you are using a proxy server to access them.
4. The use of deceptive proxy servers: Distorting Proxies
REMOTE_ADDR = proxy server IP
HTTP_VIA = Proxy server IP (Supplement: This field is filled in by the proxy server, and sometimes gateway information, etc.)
HTTP_X_FORWARDED_FOR = Random IP
Tell the visitor that you are using a proxy server, but make up a fake random IP instead of your real IP to trick it.
5. The use of high-anonymity proxy servers: High Anonymity Proxies
REMOTE_ADDR = proxy server IP
HTTP_VIA = No value or not displayed
HTTP_X_FORWARDED_FOR = No value or not displayed
Completely replaces all your information with the proxy server's information, just like you are using that proxy server to directly access the object.
In addition, proxy judges can be used to summarize some other reference judgment information and use it in practice.
Finally write a php example for your reference only: