You are here: Re: [PHP] wanting to get host name instead of ip « PHP « IT news, forums, messages
Re: [PHP] wanting to get host name instead of ip

Posted by matt VanDeWalle on 11/11/05 07:56

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
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация