PHP tip of the week: Getting IP addresses | Comments (2)
Posted in Code on 2nd December 2004, 1:07 pm by Stuart
Extracting the gateway IP address is straightforward:
$ip = $_SERVER['REMOTE_ADDR'];
To obtain the hostname of the gateway IP address just do the following:
$hostname = GetHostByName($_SERVER['REMOTE_ADDR']);
To get the local IP address of your user can sometimes be useful too. Here’s how:
$localip = $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'];

I wanted to cite some of your posts in my forum. Couldn’t find your perma-links
Hi, I’m as we speak working on the first draft of Joornal which will be a re-written blogging script to replace this one. There’s no question that permalinks will become a feature of this. Watch this space.