- file_get_contents: documentation ( source)
- unserialize: documentation ( source)
<?php
$Server_IP = $_SERVER['SERVER_ADDR'];
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$Server_IP"));
$city = $geo["geoplugin_city"];
echo "City: ".$city."<br>";