Simple PHP Proxy Detection Script IP Address

May-23-2014 in PHP No comments

Get client’s IP address in PHP

We can get the IP address of any visitor by using PHP. Finding the IP address is very important requirement for many scripts where we store the members or visitors details. For security reason we can store IP address of our visitors who are doing any purchases or doing any type of transaction online. We can using the IP address to find out geographical location of the visitor.


Sample code to get an IP address.


This server variable: $_SERVER[“REMOTE_ADDR”] to get an IP address. However, they can be behind a proxy server in which case the proxy may have set the $_SERVER[‘HTTP_X_FORWARDED_FOR’], but this value is easily spoofed. For example, it can be set by someone without a proxy, or the IP can be an internal IP from the LAN behind the proxy.

If you use proxy. Below is a sample PHP script that can detect if a user is using a proxy or not:

How to Detection Proxy use PHP Script?

Below is the standard script that can detect the real IP address of your website user with or without using a proxy:


No Responses

Add Your Comment