<?
//Using IP Sidekick for geolocation in PHP
//hboon@motionobj.com
//https://ipsidekick.com
//This uses the free plan which limits you to 1440 lookups/day.
//For a higher rate limit, look at our paid plans at https://ipsidekick.com
function resolveIP($ip) {
$string = file_get_contents("https://ipsidekick.com/{$ip}");
$json = json_decode($string);
return $json->country->name;
//These fields are available:
//return json->ip;
//return json->country->code;
//return json->country->name;
//return json->currency->code;
//return json->currency->decimals;
//return json->currency->name;
//return json->timeZone->gmtOffset;
//return json->timeZone->name;
//return json->holiday;
}
?>