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;

Comments

wisdom’s picture

Please refer this link Currency Exchange The above link does not take to the page.

wisdom’s picture

Assigned: Unassigned » wisdom
Status: Active » Fixed

changing the url

  /*$url = 'http://finance.yahoo.com/d/quotes.csv?e=.csv&f='. currency_api_get_fields($currency_array)  
              .'&s='. $from . $to .'=X';*/
  $url = 'http://download.finance.yahoo.com/d/quotes.csv?e=.csv&f='. currency_api_get_fields($currency_array) .'&s='. $from . $to .'=X';

makes it work.

Anonymous’s picture

Status: Fixed » Closed (fixed)