You are here

function smart_ip_get_maxmindgeoip_url in Smart IP 7.2

Same name and namespace in other branches
  1. 6.2 smart_ip.module \smart_ip_get_maxmindgeoip_url()
  2. 6 smart_ip.module \smart_ip_get_maxmindgeoip_url()
  3. 7 smart_ip.module \smart_ip_get_maxmindgeoip_url()

Get Maxmind GeoIP Legacy Web Services URL Reference: http://dev.maxmind.com/geoip/legacy/web-services

Parameters

String $ip_adress IP address to geolocate:

1 call to smart_ip_get_maxmindgeoip_url()
smart_ip_get_location in ./smart_ip.module
Get the geo location from the IP address

File

./smart_ip.module, line 1390
Determines country, geo location (longitude/latitude), region, city and postal code of the user, based on IP address

Code

function smart_ip_get_maxmindgeoip_url($ip_address) {
  $maxmind_license = variable_get('smart_ip_maxmind_key', '');
  switch (variable_get('smart_ip_maxmind_service', 'country')) {
    case 'country':
      return SMART_IP_MAXMIND_GEOIP_BASE_URL . "/a?l={$maxmind_license}&i={$ip_address}";
      break;
    case 'city':
      return SMART_IP_MAXMIND_GEOIP_BASE_URL . "/b?l={$maxmind_license}&i={$ip_address}";
      break;
    case 'city_isp_org':
      return SMART_IP_MAXMIND_GEOIP_BASE_URL . "/f?l={$maxmind_license}&i={$ip_address}";
      break;
    case 'omni':
      return SMART_IP_MAXMIND_GEOIP_BASE_URL . "/e?l={$maxmind_license}&i={$ip_address}";
      break;
  }
  return '';
}