Re: [PHP] Currency Exchange Database?
- From: jochem@xxxxxxxxxxxxx (Jochem Maas)
- Date: Fri, 29 Jun 2007 08:51:32 +0200
Andy B. wrote:
You could have a look at the Euro foreign exchange reference rates rom the
European Central Bank.
They also provide a regularly updated XML file:
http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html
/* pass this func a 3 letter currency code */
function getCurrentRate($curID)
{
static $rates;
if (is_null($rates)) {
$rates = array('EUR' => 1.0);
$doc = new DomDocument;
$doc->load( 'http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml' );
foreach ($doc->getElementsByTagname("Cube") as $node) {
$c = $node->getAttribute("currency") and
$rates[$c] = 1 / $node->getAttribute("rate");
}
}
return (isset($rates[$curID]) ? $rates[$curID] : 0.0);
}
.
----
Andy
-----Original Message-----
From: Tom Ray [Lists] [mailto:lists@xxxxxxxxxxxxxxxx]
Sent: Friday, June 29, 2007 02:45
To: php-general@xxxxxxxxxxxxx
Subject: [PHP] Currency Exchange Database?
I have a client that's looking to do auto conversions of currency on
their reservation payment form. No big deal, I can that part down.
However, exchange rates change on a minute to minute basis and they want
the program to automatically know the current rates. Is there an online
database or a way I can tap into a database that has that information?
Any help would be appreciated.
Thanks.
- References:
- Currency Exchange Database?
- From: "Tom Ray [Lists]"
- RE: [PHP] Currency Exchange Database?
- From: "Andy B."
- Currency Exchange Database?
- Prev by Date: simplexml_load_file and proxy auth
- Next by Date: Re: [PHP] HELP - I have tried to unsubscribe from this list mutiple times but cannot.
- Previous by thread: RE: [PHP] Currency Exchange Database?
- Next by thread: HELP - I have tried to unsubscribe from this list mutiple times but cannot.
- Index(es):
Relevant Pages
|