1. sayfa
$ curl ipinfo.io/8.8.8.8{ "ip": "8.8.8.8", "hostname": "google-public-dns-a.google.com", "loc": "37.385999999999997 -122.0840", "org": "AS15169 Google Inc.", "city": "Isparta", "region": "TR", "country": "TR", "phone": 650}
$ip = $_SERVER['REMOTE_ADDR'];$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}"));echo $details->city; // -> "Istanbul"
<?php include 'class.IPInfoDB.php'; // Load the class$ipinfodb = new IPInfoDB('YOUR_API_KEY'); $results = $ipinfodb->getCity($_SERVER['REMOTE_ADDR']); echo "Result\n";if (!empty($results) && is_array($results)) { foreach ($results as $key => $value) { echo $key . ' : ' . $value . "\n"; }}
ÖRNEK PHP
IpInfoDB Örneği (PHP)