D62 adlı üyeden alıntı:
mesajı görüntüle
31.***.**.*6
27
●1.108
31.***.**.*6
public static function getAddress(){
function curl_get_file_contents($URL)
{
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
$contents = curl_exec($c);
curl_close($c);
if ($contents) return json_encode($contents);
else return false;
}
$geo = curl_get_file_contents("http://api.ipinfodb.com/v3/ip-city/?key=$token&ip=$userIP&type=json");
$geo = array_filter(explode(";", trim($geo, "\"")));
if($geo[0] == "OK")
{
$data["countryCode"] = $geo[3];
$data["country"] = $geo[4];
$data["city"] = $geo[5];
$data["district"] = $geo[6];
@\$data["latLong"] = $geo[8].",".$geo[9];
return $data;
}
else
return false;
}Şöyle bir şey yazmıştım daha önce. Geliştirilmiş hali kendi Framework'ümde var. Bunu geliştirebilir veya direk böyle kullanabilirsin. Doğru sonuçlar veriyor. Ancak siteye üye olup, token alman gerekiyor