views:

113

answers:

4

I've tried to get the IP address of client browsing the site using $_SERVER['REMOTE_ADDR'], but I'm not getting the exact IP of the client please help me... Thanks

+3  A: 
$_SERVER['REMOTE_ADDR'] 

is the best you will get really.

There are various other headers that can be sent by the client (HTTP_FORWARDED_FOR et al.) - see this question for a complete overview - but these can be freely manipulated by the client and are not to be deemed reliable.

Pekka
thanks for help..
+1  A: 

The IP address that the server sees is the client's public-facing IP address. If they're behind a NAT router, they will have a different address inside their network.

If you run ipconfig (Windows) or ifconfig (Unix-y systems) on the client machine, you'll get their local IP address. If it's in the 192.168.x.x or 10.x.x.x ranges, they're behind a NAT router and the internet will see them coming from a different address.

Neall
thanks for help..
+1  A: 

If user is behind a proxy you will be getting the IP of the proxy. The user IP would be then either one of these (you'd need to check both): $_SERVER['HTTP_CLIENT_IP'] $_SERVER['HTTP_X_FORWARDED_FOR']

If any of them is set, then user is behind a proxy (unless he is faking those headers) and you should use them as the source IP. Else use $_SERVER['REMOTE_ADDR'].

LatinSuD
thanks for help..
A: 

For any assistance regarding domain hosting, domain to Ip, Ip to domain everything can be chcked in here, [URL="http://www.ip-details.com/"]http://www.ip-details.com/[/URL] and even check your internet speed by few steps.

prasath