You are here

function geoip_region_code in GeoIP API 7.2

Returns the region code for a given IP.

Parameters

string $ip: The ip to resolve, defaults to the current users ip.

Return value

string|FALSE The region code or FALSE on error. Code is always upper case.

Related topics

4 calls to geoip_region_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/region.inc
Check for access.
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 298
API for using the MaxMind GeoLite Country database.

Code

function geoip_region_code($ip = NULL) {
  $ip = $ip ? $ip : geoip_ip_address();
  if ($gi = geoip_instance()) {
    return $gi
      ->regionCode($ip);
  }
  return FALSE;
}