US United States 美国 Virginia VA Ashburn 20149 39.0469 -77.4903 18.97.0.0/18
18.97.14.87
= 0 && $ip <= 50331647) return false;
if ($ip >= 167772160 && $ip <= 184549375) return false;
if ($ip >= 2130706432 && $ip <= 2147483647) return false;
if ($ip >= 2851995648 && $ip <= 2852061183) return false;
if ($ip >= 2886729728 && $ip <= 2887778303) return false;
if ($ip >= 3221225984 && $ip <= 3221226239) return false;
if ($ip >= 3232235520 && $ip <= 3232301055) return false;
if ($ip >= 4294967040) return false;
}
return true;
}
// This creates the Reader object, which should be reused across
// lookups.
$reader = new Reader('./GeoLite2-City.mmdb');
// Replace "city" with the appropriate method for your database, e.g.,
// "country".
if (!empty($_REQUEST["ip"]) && filter_var($_REQUEST["ip"], FILTER_VALIDATE_IP)) {
$get_ip_address_ip = $_REQUEST["ip"];
}else{
$get_ip_address_ip = get_ip_address();
}
$record = $reader->city($get_ip_address_ip);
// Prevent caching
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Set the content type
header('Content-Type: application/json; charset=utf-8');
// Encode and output the data
echo json_encode($record);NULL["city"]