public function GeoIpHandlerV1::countryName in GeoIP API 7.2
Returns the country 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 Country name or FALSE on failure.
Overrides GeoIpHandlerInterface::countryName
1 call to GeoIpHandlerV1::countryName()
- GeoIpHandlerV1::rawRecord in src/
GeoIpHandlerV1.php  - Returns an array of all information related the ip.
 
File
- src/
GeoIpHandlerV1.php, line 147  - The GeoIP API handler for version 1 - legacy.
 
Class
Namespace
Drupal\geoipCode
public function countryName($ip = NULL) {
  try {
    return geoip_country_name_by_addr($this
      ->getReader(), $ip);
  } catch (\Exception $e) {
    return FALSE;
  }
}