tags:

views:

31

answers:

3

Yahoo's service doesn't seem to provide an API I can use. What web services are there for currency conversions?

A: 

Maybe this could be helpful:

http://www.programmableweb.com/api/currency-rates

mamoo
A: 

You can do currency conversion using Yahoo's API, e.g. like this in PHP:

<?php
$from   = 'USD'; //US Dollar
$to     = 'PHP'; //to Philippine Peso

$url = 'http://finance.yahoo.com/d/quotes.csv?e=.csv&amp;f=sl1d1t1&amp;s='. $from . $to .'=X';
$handle = @fopen($url, 'r');
if ($handle) {
  $result = fgets($handle, 4096);
  fclose($handle);
}

$array = explode(',',$result);

var_dump($array);

/*
OUTPUTS: 
  array(4) {
  [0]=>
  string(10) ""USDPHP=X""
  [1]=>
  string(6) "47.125"
  [2]=>
  string(11) ""10/3/2008""
  [3]=>
  string(10) ""5:03pm"
"
}

*/

From here.

Dominic Rodger
hi, thanks for your help, that is great, but seem it just got current exchange rate, it seem not accept time argument, I also want find history exchange rate, does it support ? thanks again for you help !
Robin