Wednesday, July 29, 2009

Currency Converter in 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 );
$matches = array();
preg_match( '/= (([0-9]|\.|,|\ )*)/', $askGoogle, $matches );
return $matches[1] ? $matches[1] : false;
}

echo exchangeRate( 1, 'dollars','rupee');




if(isset($from2) && trim($from2)!="" && isset($to) && trim($to)!=""){
?>

}else{
?>

}
?>

No comments:

Post a Comment