Have an account? Sign in
Login  Register  Facebook
This Page is Under Construction! - If You Want To Help Please Send your CV - Advanced Web Core (BETA)
[Edit] Stock and currency quotes from Yahoo Finance
The $ticker variable can be currency or stocks. Lots of info can be gathered from this script such as, high/low of the day, open quotes, last trade, time of last trade, volume, etc. Yahoo Finance has all the symbols you need such as RHAT for Red Hat, AAPL for Apple, and all the currency symbols like CADUSD=X for US Dollar and Canadian dollar.
$us_price = '100';

$ticker= 'CADUSD=X';
$open = fopen("http://quote.yahoo.com/d/quotes.csv?s=$ticker&f=sl1d1t1c1ohgv&e=.csv", "r");
$exchange_rate = fread($open, 2000);
fclose($open);
$exchange_rate = str_replace("\"", "", $exchange_rate);
$exchange_rate = explode(",", $exchange_rate);
$ca_price = ($us_price/$exchange_rate[1]);
$price = number_format ($ca_price, 2);

echo "$us_price US dollars = \$$price Canadian dollars";