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:

<?php
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:

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


demo here on left block
www.UcChau.Net
www.XoopsViet.Org

Login

Who's Online

137 user(s) are online (73 user(s) are browsing Support Forums)


Members: 0


Guests: 137


more...

Donat-O-Meter

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

Latest GitHub Commits