Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the client-side machine name?

Status
Not open for further replies.

Apollo6

Technical User
Jan 27, 2000
418
US
PHP - 4.3.1
Apache - 1.3.33
Server OS - W2003
Clients - W2000 and XP

We have a Trouble Ticket application that our users submit tickets with. It sends an email to IT so we can resolve. I have modified the email to include the machine's IP address that the ticket was submitted from. However, I would also like to get the actual machine name that the ticket was submitted from as well.

For the IP, I use the following:
$ip = getenv('REMOTE_ADDR');

Is there a call to get the 'REMOTE_NAME'?

Thanks for any assistance.
 
Had you looked through the PHP online manual, you would have foun this right next to the REMOTE_ADDR usage:
PHP online Manual said:
$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the webserver. [red]There is no guarantee that every webserver will provide any of these; servers may omit some, or provide others not listed here.[/red]

'REMOTE_HOST'

The Host name from which the user is viewing the current page. The reverse dns lookup is based off the REMOTE_ADDR of the user.

Note: Your web server must be configured to create this variable. For example in Apache you'll need HostnameLookups On inside httpd.conf for it to exist. See also gethostbyaddr().

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks vacunita-

This is what I found and got to work, I just didn't follow-up on my post...

$host = gethostbyaddr($_SERVER['REMOTE_ADDR']);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top