public function GeoIpHandlerV1::continentName in GeoIP API 7.2
Returns the continent name for a given IP.
Defaults to using the current user's IP if not specified.
Parameters
string $ip: The ip to resolve.
Return value
string|FALSE Continent name or FALSE on failure.
Overrides GeoIpHandlerInterface::continentName
1 call to GeoIpHandlerV1::continentName()
- GeoIpHandlerV1::rawRecord in src/
GeoIpHandlerV1.php - Returns an array of all information related the ip.
File
- src/
GeoIpHandlerV1.php, line 118 - The GeoIP API handler for version 1 - legacy.
Class
Namespace
Drupal\geoipCode
public function continentName($ip = NULL) {
try {
if ($this
->record($ip)->continent_code != '--') {
$continents = geoip_continents_list();
return $continents[strtoupper($this
->record($ip)->continent_code)];
}
return FALSE;
} catch (\Exception $e) {
return FALSE;
}
}