How to show an IP address ??



Helo guys,

I have a php script like :
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
echo $hostname;

When it runs on a local server, it shows IP : localhost

But the problem is, when i upload the file, it shows IP :

Why is different? And what IP address ( is it?

Can u give me a better solution? Thx b4.
$_SERVER['REMOTE_ADDR'] is the IP address.

gethostbyaddr($_SERVER['REMOTE_ADDR']) finds the hostname for that IP address. In case of localhost, that's retrieved from the hostfile. For the second, it can't find it in the hostfile and uses a DNS query to resolve it. is the name for that IP address, which is normally an identifier for the ISP. In this case the ISP is PCCW Global (