function geoip_country_code in GeoIP API 7.2
Same name and namespace in other branches
- 5 geoip.module \geoip_country_code()
- 6 geoip.module \geoip_country_code()
- 7 geoip.module \geoip_country_code()
Returns the ISO 3166-2 country code for a given IP.
Parameters
string $ip: The ip to resolve, defaults to the current users ip.
Return value
string|FALSE Country code or FALSE on error. Code is always upper case.
Related topics
5 calls to geoip_country_code()
- geoip_admin_settings in ./
geoip.admin.inc - Menu callback and form builder for admin/settings/geoip.
- geoip_ctools_plugin_region_ctools_access_check in plugins/
access/ country.inc - Check for access.
- geoip_rules_condition_country_compare in ./
geoip.rules.inc - Checks if the detected country matches to one in the list.
- geoip_tokens in ./
geoip.tokens.inc - Implements hook_tokens().
- geoip_views_query_substitutions in ./
geoip.module - Implements hook_views_query_substitutions().
File
- ./
geoip.module, line 264 - API for using the MaxMind GeoLite Country database.
Code
function geoip_country_code($ip = NULL) {
$ip = $ip ? $ip : geoip_ip_address();
if ($gi = geoip_instance()) {
return $gi
->countryCode($ip);
}
return FALSE;
}