Re: Client IP

From: Date: Wed, 07 Jul 2004 22:59:34 +0000
Subject: Re: Client IP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-189915@lists.php.net to get a copy of this message
Matthew Sims wrote:
Hi, How can I get remote IP adress of client? I use the fillow script:: $ip=getenv('HTTP_X_FORWARDED_FOR'); if (!$ip) { $ip = getenv('REMOTE_ADDR'); } But sometime it return me "unknown" sa IP adress. Can someone help me ? Thanks in advance!
$_SERVER["REMOTE_ADDR"]
Either method will work. You just have to realize that sometimes the IP address is not sent. There is no reliable way to get the clients IP address, so do not depend on it. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#189915) next »