Closed (fixed)
Project:
Currency
Version:
5.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
7 Sep 2007 at 00:04 UTC
Updated:
5 Dec 2010 at 23:03 UTC
Jump to comment: Most recent file
I had to ad some slight modification to the currency module in order to access remotely yahoo finance using the following code and the application was working gracefully. I needed to use curl because my host does not allow direct remote file access.
However when I check it today it does not give exchange value. It just gives zero. The website where the application is running is: currency exchange
//$record = file_get_contents($url);
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, "$url");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
//$file_contents = curl_exec($ch);
$record = curl_exec($ch);
curl_close($ch);
// display file
//echo $file_contents;
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | currency_5.patch | 737 bytes | meba |
| #2 | currency_4.patch | 1.2 KB | meba |
Comments
Comment #1
wisdom commentedchanging the url
makes it work.
Comment #2
meba commentedThis is definitely not "fixed". At least the yahoo URL is stil invalid, but allow_url_fopen is Off on many webhosts. I am attaching the patch doing:
1) Fixing yahoo URL
2) Adding CURL to currency_api, using CURL as default, using file_get_contents() as a fallback
Comment #3
meba commentedSome typos, rerolling
Comment #4
amateescu commentedLatest release from the 5.x branch uses drupal_http_request().