Tracking an user

Tracking an user is very easy in php. It requires a single line to get the client ip address.

The line is $ip=$_SERVER['REMOTE_ADDR'];

Easy. Isn’t it?

Just put the following code in a php file and upload to your domain.

<?php
echo $_SERVER['REMOTE_ADDR'];
?>

Then open the page using your browser. It will print your ip address. Check it.

If you do this to your localhost (not in the server), it will print the virtual server ip address that is 127.0.0.1 which is default for all localhost (not in the server but may be built up in desktop)

Tags:, , ,

This entry was posted on Sunday, September 6th, 2009 at 10:56 pm and is filed under PHP.

You can follow any responses to this entry through the RSS 2.0 feed.

You can leave a response, or trackback from your own site.

Leave a Reply