$ip = $_SERVER['REMOTE_ADDR']; $details = json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip={$ip}")); echo $details;