‘;
// Mostra full Json info of the machine calling this url …:
$ip=$_SERVER[‘REMOTE_ADDR’];
$ip = trim($ip);
#$oldip = file_get_contents(‘imacip.csv’);
//echo “il vecchio ip era $oldip”;
//$ch = curl_init(“http://api.ipstack.com/check?access_key=b045a861eae18824eb3278c915e455f7”);
$ch = curl_init(“http://api.ipstack.com/$ip?access_key=920474914f81dd59331ebd665bec95a7”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$json = curl_exec($ch);
//$json = file_get_contents(‘http://api.ipstack.com/check?access_key=b045a861eae18824eb3278c915e455f7’);
//echo “Json is $json”;
// Umbria
// Trim geolocation based on Json ip formatting
$json_ip = json_decode($json);
$currentcountry = $json_ip->country_name;
$currentcity = $json_ip->city;
$currentip = $json_ip->ip;
$currentregion = $json_ip->region_name;
if (is_null($currentregion)) {
$currentregion = “UNSET”;
}
//echo “currentcountry is $currentcountry
“;
//echo “currentregion is $currentregion
“;
//echo “currentip is $currentip
“;
$postcolor = “”;
// pretty format outup string
//echo “pretty is $json_pretty”;
// currentcity is
$currentcity
curl_close($ch);
//$outtext= “currentcountry is $currentcountry
currentregion is $precolor $currentregion $postcolor
currentip is $currentip
“;
echo ”
“;
echo ”
“;
#$outtext= ”
IP:$currentip, $currentcountry, $precolor $currentregion $postcolor
,$datetime“;
?>