$ipaddress=’xxx.xx.xx.xxx’;
$ch = curl_init();
curl_setopt ($ch,CURLOPT_URL,”https://www.geoplugin.net/php.gp?ip=’$ipaddress'”);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 30);
$geoData = unserialize(curl_exec($ch));
$curl_error = curl_error($ch);
curl_close($ch);
print_r($geoData);