I wrote this to save the IP address of the client that downloads it.
This was mostly done to overcome having a box on on dynamic IP address that I had to access from the outside world.
It's rather simple, if $save_to_file is set to TRUE the script will save the IP address and hostname to a file. Otherwise it'll just diplsay it in the web browser.
By default this file is called ipaddress.txt and is located in the same directory as the PHP script itself.
The best way to use this is to have the machine who's IP you're trying to keep track of download the script every few minutes.
You'll need to place the script itself on a webserver that is accessible (and preferably pretty reliable) to the cleint machine.
Simply add this to your cleint's crontab:
*/15 * * * * wget -O - -q -t 1 example.com/phpipaddress/index.php >/dev/null 2>&1
You can substitute wget for your favorite http client.