You are here

public function GeoIpHandlerV2::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

File

src/GeoIpHandlerV2.php, line 114
The GeoIP API handler for version 2.

Class

GeoIpHandlerV2

Namespace

Drupal\geoip

Code

public function continentName($ip = NULL) {
  try {
    return $this
      ->record($ip)->continent->name;
  } catch (\Exception $e) {
    return FALSE;
  }
}