Connecting Tech Pros Worldwide Forums | Help | Site Map

Is there a way to get Computer Name in php ?

Maverick
Guest
 
Posts: n/a
#1: Jul 17 '05
I'm trying to get the " Computer Name " of a client accessing my web
site,
is there a way to do this ? not ip...

tia


Gordon Burditt
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Is there a way to get Computer Name in php ?


>I'm trying to get the " Computer Name " of a client accessing my web[color=blue]
>site,
>is there a way to do this ? not ip...[/color]

What's a "Computer Name"? If it's the DNS name, you could try
taking the IP and doing a reverse DNS lookup on it (gethostbyaddr()).
That may fail, though, especially for ISPs with large banks of
dialup lines where they don't bother.

If "Computer Name" is some kind of Windows-only thing, expect problems
with non-Windows systems.

Gordon L. Burditt
Mladen Gogala
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Is there a way to get Computer Name in php ?


On Thu, 07 Jul 2005 15:40:12 -0700, Maverick wrote:
[color=blue]
> I'm trying to get the " Computer Name " of a client accessing my web
> site,
> is there a way to do this ? not ip...
>
> tia[/color]

This is what you need:

$box=php_uname('n');

--
http://www.mgogala.com

Gordon Burditt
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Is there a way to get Computer Name in php ?


>> I'm trying to get the " Computer Name " of a client accessing my web[color=blue][color=green]
>> site,
>> is there a way to do this ? not ip...
>>
>> tia[/color]
>
>This is what you need:
>
> $box=php_uname('n');[/color]

This gives no information about the *CLIENT* whatever.
It gives information on the SERVER.

Gordon L. Burditt
Mladen Gogala
Guest
 
Posts: n/a
#5: Jul 17 '05

re: Is there a way to get Computer Name in php ?


On Fri, 08 Jul 2005 03:27:41 +0000, Gordon Burditt wrote:
[color=blue][color=green][color=darkred]
>>> I'm trying to get the " Computer Name " of a client accessing my web
>>> site,
>>> is there a way to do this ? not ip...
>>>
>>> tia[/color]
>>
>>This is what you need:
>>
>> $box=php_uname('n');[/color]
>
> This gives no information about the *CLIENT* whatever.
> It gives information on the SERVER.
>
> Gordon L. Burditt[/color]

You are right, I should have read it more carefully. Fortunately, there
is an example in the manual page. This is cut & paste from the online
manual:

<?php
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);

echo $hostname;
?>


--
http://www.mgogala.com

futureofphp
Guest
 
Posts: n/a
#6: Jul 17 '05

re: Is there a way to get Computer Name in php ?


I tried this method, using gethostbyaddr, its good but it is too slow
and it takes time for the page to load.

Closed Thread