You are here

function smart_ip_get_maxmindgeoip2_url in Smart IP 7.2

Same name and namespace in other branches
  1. 6.2 smart_ip.module \smart_ip_get_maxmindgeoip2_url()

Get Maxmind GeoIP2 Precision Web Services URL Reference: http://dev.maxmind.com/geoip/geoip2/web-services

Parameters

String $ip_adress IP address to geolocate:

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

File

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

Code

function smart_ip_get_maxmindgeoip2_url($ip_address) {
  $maxmind_uid = variable_get('smart_ip_maxmind_geoip_uid', '');
  $maxmind_license = variable_get('smart_ip_maxmind_geoip_license', '');
  $service_type = variable_get('smart_ip_maxmind_geoip_service', 'country');
  $url = str_replace('://', "://{$maxmind_uid}:{$maxmind_license}@", SMART_IP_MAXMIND_GEOIP_BASE_URL) . "/geoip/v2.1/{$service_type}/{$ip_address}";
  return $url;
}