Posts Tagged ‘ip php’

Getting real IP address in PHP

Are you using $_SERVER to find the the client's IP address in PHP? Well dude, you might be amazed to know that it may not return the true IP address of the client at all time. If your client is connected to the Internet through Proxy Server then $_SERVER in PHP just returns the the IP address of the proxy server not of the client's machine. So here is a simple function in PHP to find the real IP address of the client's machine. There are extra Server variable which might be available to determine the exact IP address of the client's machine in PHP, they are HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR. Full story
Copyright © 2014 Roshan Bhattarai's Blog. All rights reserved.
Powered by WordPress.org, Custom Theme and ComFi.com Calling Card Company.