This article is about retrieved user real IP address by using PHP script. It's very important for a website to track visitors IP address and location. You can monitor your website's traffic location using IP address. So, why late? Let's see how to get user real IP address using PHP.
This script is ready to use. If you execute this script on local server like wamp or xampp then this script will show your IP 127.0.0.1 that means your localhost IP address. When you will execute this script in online server then this script will show your IP address which is provided by your ISP .
Normally we get client IP address using $_SERVER['REMOTE_ADDR'] but using this script we will get user real IP if any user will use proxy & multiple IP. $_SERVER["HTTP_X_FORWARDED_FOR"] will retrieve real IP address if any user will use proxy and $_SERVER["HTTP_CLIENT_IP"] checks if multiple IP addresses exist. This is an advance method to retrieve any client's IP address.