curl support

vangorra - July 31, 2008 - 17:04
Project:GeoNames
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Since using file_get_contents with urls requires a config change. It would be good if geonames would use curl first (if it is available). Here is a snippit that will do the trick. This should go in geonames.module (line 175)

if(function_exists('curl_init')) {
$ch = curl_init(geonames_service_url($service) . $querystring . '&app=drupal');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
$data = curl_exec($ch);
} else {
$data = file_get_contents(geonames_service_url($service) . $querystring . '&app=drupal');
}

#1

lyricnz - September 14, 2009 - 05:47

Should probably be changed to drupal_http_request, not curl directly. In any case, I don't think either of the maintainers are doing any 5.x updates anymore.

 
 

Drupal is a registered trademark of Dries Buytaert.