You are here

function _ip2country_fetch_page in IP-based Determination of a Visitor's Country 5

Same name and namespace in other branches
  1. 6 ip2country.inc \_ip2country_fetch_page()
  2. 7 ip2country.inc \_ip2country_fetch_page()

Fetch the pages with cURL

Parameters

$url: The ftp URL where the file is located

1 call to _ip2country_fetch_page()
ip2country_update_database in ./uc_ip2country.inc
Update the database

File

./uc_ip2country.inc, line 132
Utility routines to load the IP to Country database.

Code

function _ip2country_fetch_page($url) {
  $curl = curl_init();
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_TIMEOUT, 60 * 5);
  curl_setopt($curl, CURLOPT_USERAGENT, "Drupal (+http://drupal.org/)");
  curl_setopt($curl, CURLOPT_HEADER, 0);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
  $html = curl_exec($curl);
  curl_close($curl);
  return $html;
}