You are here

function smart_ip_get_maxmindgeoip_url in Smart IP 7

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.2 smart_ip.module \smart_ip_get_maxmindgeoip_url()

Get Maxmind GeoIP URL

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 680
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_key = variable_get('smart_ip_maxmind_key', '');
  switch (variable_get('smart_ip_maxmind_service', 'country')) {
    case 'country':
      return "https://geoip.maxmind.com/a?l={$maxmind_key}&i={$ip_address}";
      break;
    case 'city_isp_org':
      return "https://geoip.maxmind.com/b?l={$maxmind_key}&i={$ip_address}";
      break;
    case 'omni':
      return '';
      break;
  }
  return '';
}