city($clientip); exitWithJson([ "status" => "OK", "location" => [ "latitude" => $record->location->latitude, "longitude" => $record->location->longitude ], "clientip" => $clientip, "postcode" => $record->postal->code, "attribution" => "This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com." ]); } catch (GeoIp2\Exception\AddressNotFoundException $ex) { exitWithJson([ "status" => "ERROR", "message" => "Location not found for IP address.", "clientip" => $clientip ]); }