<?php
  $unitprice = 1399.99; //sample, is actually pulled from a DB
function exchangeRate( $amount, $currency, $exchangeIn )
{
	$googleQuery = $amount . ' ' . $currency . ' in ' . $exchangeIn;
	$googleQuery = urlEncode( $googleQuery );
	$askGoogle = file_get_contents( '<a href="http://www.google.com/search?q=" rel="nofollow">http://www.google.com/search?q=</a>' . $googleQuery );
	$askGoogle = strip_tags( $askGoogle );
	$matches = array();
	preg_match( '/= (([0-9\s]|\.|,|\ )*)/', $askGoogle, $matches ); //removes the space for actual conversion process...
	return $matches[1] ? $matches[1] : false;
}

//exchangeRate( $unitprice, "cad", "usd");

$roundIt = exchangeRate( $unitprice, "cad", "usd");

echo $roundIt;
?>