Re: wanting to get host name instead of ip

From: Date: Fri, 11 Nov 2005 05:56:23 +0000
Subject: Re: wanting to get host name instead of ip
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-225600@lists.php.net to get a copy of this message
yes, you assume right, I really did mean socket_getpeername() its about midnight here and my brain shuts down at about 10:30 :p thanks for the reply matt On Thu, 10 Nov 2005, Curt Zirzow wrote:
On Thu, Nov 10, 2005 at 11:35:06PM -0600, matt VanDeWalle wrote:
hello, I was wondering, is there a way to get a connection's name(host's name instead of just ip), i am using the cli version of php and am now using the function getpeername() but for example, i would like to be able to have it say something like "connection: localhost ...." instead of "connection: 127.0.0.1" is this possible with the command line interface?
I assume you really mean socket_getpeername(). You just have to do a reverse lookup using gethostbyaddr(), pending your host and named settings you will get back either localhost or the hostname you have (hopefully it is localhost), if it can't be resolved it will be the IP. if it is the IP instead of a localhost/hostname you'll have to fix your systems configuration. Curt. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#225600) next »