Re: Getting my IP adress (not 127.0.0.1)
| From: | erythros | Date: | Fri, 29 Nov 2002 01:46:31 +0000 |
| Subject: | Re: Getting my IP adress (not 127.0.0.1) | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-17209@lists.php.net to get a copy of this message | ||
here's a simple way
<?echo "$_SERVER[REMOTE_ADDR]"?>
"Steve Yates" <steve@srtware.com> wrote in message
news:20021128073939.81023.qmail@pb1.pair.com...
> "Michael Delorme" <michael@delorme.nom.fr> wrote
> > However I only get 127.0.0.1
> > But I want the "public" dynamic adress my ISP gave me,
>
> Don't use localhost, that's always 127.0.0.1 by definition. You
didn't
> say what server you are using but if it's Apache try...
>
> getenv('SERVER_ADDR');
> or
> gethostbynamel(getenv('HTTP_HOST'));
>
> phpinfo() should tell you what environment variables are available for
your
> server.
>
> - Steve Yates
> - I have nothing against MS-DOS, stone knives, or bearskins.
>
> ~ Taglines by Taglinator - www.srtware.com ~
>
>
>