My web page needs to determine the client's external IP address, i.e., the
IP address that others viewing the web page would be able to use to contact
that user's machine (assuming they've setup the appropriate forwarding into
their actual machine of course). In this environment the clients want their external IP to be correctly reported, so there's no issue of people trying to spoof and
show a wrong IP.

I'm currently using $_SERVER['REMOTE_ADDR'] as this seemed like the best
approach as I thought it would yield the IP as seen from the web server and
hence, hopefully, as seen by everyone else on the internet.

This works in many cases, but in a couple cases users have reported issues
with others not being able to use the IPs the web page reports to contact their
machines.  In these cases the $_SERVER['REMOTE_ADDR'] seems to be returning
a different IP than what www.whatismyip.com <http://www.whatismyip.com> returned, for example.

Is there another reccomended way to get the client's externally visible IP
address?  Or is $_SERVER['REMOTE_ADDR'] the right approach but might
not always work?

Thanks!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to