Wrong IP address
| From: | Peter Albertsson | Date: | Tue, 30 Mar 2004 08:06:06 +0000 |
| Subject: | Wrong IP address | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-181785@lists.php.net to get a copy of this message | ||
If your request is going through a proxy, $_SERVER["REMOTE_ADDR"] will
contain the ip address for the proxy. The proxy might add a
HTTP_X_FORWARDED_FOR header to the request which will contain the ip address
of the client to the proxy, which should be where the request originated. It
is possible for a request to travel through several proxies and then the
HTTP_X_FORWARDED_FOR header will be added several times.
$_SERVER['HTTP_X_FORWARDED_FOR'] if exists will contain the ip address of
where the request originated if the request was proxied.
$_SERVER['HTTP_X_FORWARDED_FOR'] may be an array if the request was proxied
several times.
Regards,
Peter Albertsson
-----Original Message-----
From: ascll [mailto:ascll@yahoo.com]
Sent: den 30 mars 2004 03:13
To: php-general@lists.php.net
Subject: [PHP] Wrong IP address
Greetings,
I make use of these: -
<?php
echo($_SERVER["REMOTE_ADDR"]);
?>
to get the web IP address for my machine once my PC is connected to
Internet..
Anyway, sometime I get the correct IP address, but sometime NOT.
Does anyone know why?
Thanks in advance.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php