function _ip2country_fetch_page in IP-based Determination of a Visitor's Country 6
Same name and namespace in other branches
- 5 uc_ip2country.inc \_ip2country_fetch_page()
- 7 ip2country.inc \_ip2country_fetch_page()
Fetches the pages via FTP with cURL.
Parameters
$url: The ftp URL where the file is located.
Return value
FALSE if ftp fetch failed. Otherwise, a string containing the contents of the fetched file.
1 call to _ip2country_fetch_page()
- ip2country_update_database in ./
ip2country.inc - Updates the database.
File
- ./
ip2country.inc, line 148 - Utility routines to load the IP to Country database.
Code
function _ip2country_fetch_page($url) {
$curl = curl_init();
// Fetch requested file.
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_TIMEOUT, 60 * 2);
curl_setopt($curl, CURLOPT_USERAGENT, 'Drupal (+http://drupal.org/)');
curl_setopt($curl, CURLOPT_HEADER, FALSE);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
$html = curl_exec($curl);
curl_close($curl);
return $html;
}