Re: Remote computer name?
| From: | Mike Migurski | Date: | Thu, 20 Nov 2003 18:42:20 +0000 |
| Subject: | Re: Remote computer name? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170467@lists.php.net to get a copy of this message | ||
>> [Snippit used]
>> $ipaddy = $_SERVER['REMOTE_ADDR'];
>> $host = $_SERVER['HTTP_HOST']; // as of now it is getting the name of
>> the server (i.e. localhost, 168.2.2.1)
>>
>> jas
>
>HTTP_HOST returns the name (or ip) of the machine on which php is
>running. REMOTE_ADDR will return the ip of the client accessing the
>document.
More specifically, HTTP_HOST returns the hostname used in the current
request - this may change depending on virtual host settings and relies
upon the Host: header in the request. SERVER_NAME returns the name of the
machine on which php is running, and (afaik) is /not/ dependent on the
virtual host used. The two values are frequently the same.
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html