Re: Client IP
| From: | Rosen | Date: | Wed, 07 Jul 2004 23:05:52 +0000 |
| Subject: | Re: Client IP | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-189916@lists.php.net to get a copy of this message | ||
IP adress not send ?!? And how server communicate with client ?
"John W. Holmes" <holmes072000@charter.net> wrote in message
news:40EC8056.7050704@charter.net...
> 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