1
mrphilong
Exchange Rate block for u

I hope someone would develope this further into a module, we really really need an Exchange Rate module. From research, I found to get an exchange rate feed from Google:

xrate.php code:

function exchangeRate$amount$currency$exchangeIn )
{
$googleQuery $amount ' ' $currency ' in ' $exchangeIn;
$googleQuery urlEncode$googleQuery );
$askGoogle file_get_contents'http://www.google.com/search?q=' $googleQuery );
$askGoogle strip_tags$askGoogle );
if (
preg_match("/Rates provided for information only - see disclaimer./i"$askGoogle)) {
$matches = array();
preg_match'/= (([0-9]|.|,| )*)/'$askGoogle$matches );
return 
$matches[1] ? $matches[1] : false;
}
else {
$status "google says no";
return 
$status;
}
}
?>



put the following code into your PHP block:

require( '/path.to/xrate.php' );
echo 
'1 AUD = '.round((str_replace ("","",(exchangeRate(1'aud''usd' )))),4).' USD';
echo 
'
'
;
echo 
'1 AUD = '.round((str_replace ("","",(exchangeRate(1'aud''vnd' )))),4).'000 VND';
echo 
'
'
;
echo 
'1 AUD = '.round((str_replace ("","",(exchangeRate(1'aud''cad' )))),4).' CAD';
echo 
'
'
;
echo 
'1 AUD = '.round((str_replace ("","",(exchangeRate(1'aud''jpy' )))),3).' YEN';
echo 
'
'
;
echo 
'1 AUD = '.round((str_replace ("","",(exchangeRate(1'aud''eur' )))),4).' EUR';
echo 
'
'
;
echo 
'1 AUD = '.round((str_replace ("","",(exchangeRate(1'aud''nzd' )))),4).' NZD';
?>


demo here on left block

Login

Who's Online

365 user(s) are online (286 user(s) are browsing Support Forums)


Members: 0


Guests: 365


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits