Re: wanting to get host name instead of ip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux