Re: Best way to get the remote IP address?
| From: | Ing. Daniel Manrique | Date: | Mon, 21 Jan 2002 20:12:34 +0000 |
| Subject: | Re: Best way to get the remote IP address? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-81431@lists.php.net to get a copy of this message | ||
> I can't seem to find any references to HTTP_X_FORWARDED_FOR in the PDF PHP
> documentation from January 2001, so you should probably best stick with
> either $HTTP_SERVER_VARS['REMOTE_ADDR'] or simply $REMOTE_ADDR (if you use
> $REMOTE_ADDR in functions make sure you do a global on it first) - I
> personally use $REMOTE_ADDR, but you should read the docs for details...
That's because it's probably not so much a PHP thing. X-Forwarded-For is
normally used when going through a proxy. Say my internal IP is
192.168.1.15, and my proxy's official IP address is 132.248.10.2, then
we'd have this:
REMOTE_ADDR=132.248.10.2
X_FORWARDED_FOR=192.168.1.15
That way, even when going through a proxy, there's information about who
originally submitted the request.