Log in

View Full Version : HTTP_REMOTE_HOST problem



meatwad
11-02-2006, 01:00 AM
Hi there. I've been programming websites with PHP and know it pretty well. Thing is, I think they've updated since a long time, and the HTTP_REMOTE_HOST isn't working prior to this post (http://www.dynamicdrive.com/forums/showthread.php?t=5501). I was a little disappointed, but it is a pretty old post. (2005)

Getting help on this problem would be great and well appreciated.


-Meatwad

codeexploiter
11-02-2006, 03:56 AM
If you are looking for finding the client IP address and the host name the following code will do that



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

echo $clientip."<br>"; //Display the IP of the client
echo $clienthostname ."<br>"; //Display the host name based on the client IP
?>


Hope this is what you are looking

Twey
11-02-2006, 11:33 AM
As far as I'm aware, $_SERVER['REMOTE_HOST'] still works.