How can I find IP address....
| From: | Mihai Dumitrescu | Date: | Wed, 13 Dec 2000 18:56:18 +0000 |
| Subject: | How can I find IP address.... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-30141@lists.php.net to get a copy of this message | ||
Dear Razvan,
The value of $REMOTE_ADDR is not ever the IP address of your client. It is
possible to be the IP address of his cache server ( from his ISP ).
If you want to be sure which is the IP address of your client, is better to
use this code:
<?
if(getenv("HTTP_X_FORWARDED_FOR")){
$ip=getenv("HTTP_X_FORWARDED_FOR");
}
else{
$ip=getenv("REMOTE_ADDR");
}
?>
Now, the $ip value is the address which you want.
Mihai