Re: === REMOTE_DOMAIN ===
| From: | php4 at developersdesk dot com | Date: | Wed, 06 Dec 2000 19:14:48 +0000 |
| Subject: | Re: === REMOTE_DOMAIN === | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-40279@lists.php.net to get a copy of this message | ||
Addressed to: "Samuel Desramont" <sdesramont@pagenet.fr>
php-dev@lists.php.net
** Reply to note from "Samuel Desramont" <sdesramont@pagenet.fr> Wed, 6 Dec 2000
16:51:47 -0000
>
> Hi,
>
> I would like to get the remote domain of a client visiting my
> website. How can I ?
>
> I've found the way to get the IP address
> ($IP_addr=getenv("REMOTE_ADDR");) but not the remote domain.
>
This list is for the development of PHP, rather than its usage. If you
have further questions please submit them to the php-general list, or
one of the other lists at:
http://www.php.net/support.php
In answer to your question, take a look at:
http://www.php.net/manual/html/function.gethostbyaddr.html
You don't need to use getenv() with php, the $REMOTE_ADDR variable
should already be defined in the global context. If you want to see it
from inside a function, you will need to use a global declaration.
You might be able to enable hostname lookups on your web server and use
the HTTP_HOST variable, but unless you need it on every page served it
is a waste of time.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com