|
Posted by Curt Zirzow on 11/11/05 08:07
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.
--
Navigation:
[Reply to this message]
|