public function GeoIpHandlerV1::regionCode in GeoIP API 7.2
The region code for a given IP.
This will just return the most accurate subdivision if there are multiple levels.
Parameters
string $ip: The ip to resolve.
Return value
string|FALSE The region name or FALSE on failure. Code is always upper case.
Overrides GeoIpHandlerInterface::regionCode
File
- src/
GeoIpHandlerV1.php, line 159 - The GeoIP API handler for version 1 - legacy.
Class
Namespace
Drupal\geoipCode
public function regionCode($ip = NULL) {
try {
// @TODO Make compatible to V2 - Letter codes.
return strtoupper(geoip_region_by_addr($this
->getReader(), $ip));
} catch (\Exception $e) {
return FALSE;
}
}