You are here

function smart_ip_file_get_contents in Smart IP 6.2

Same name and namespace in other branches
  1. 7.2 smart_ip.module \smart_ip_file_get_contents()

Get contents of given path

1 call to smart_ip_file_get_contents()
smart_ip_get_csv_source_filename in ./smart_ip.module
Helper function for grabbing Maxmind's CSV archive filename.

File

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

Code

function smart_ip_file_get_contents($url) {
  if (function_exists('curl_version')) {
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $contents = curl_exec($curl);
    curl_close($curl);
  }
  else {
    $contents = file_get_contents($url);
  }
  return $contents;
}