USD to INR Currency Converter in php


Zend Tutorial

<?php

$from = ‘USD’; //US Dollar
$to = ‘INR’; //to Philippine Peso
$amount= 2;
$url = ‘http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s‘. $from . $to .’=X’;
$handle = @fopen($url, ‘r’);
if ($handle) {
$result = fgets($handle, 4096);
fclose($handle);
}

$array = explode(‘,’,$result);
$amountinr= $array[1]*$amount;
echo $amountinr;exit();
//var_dump($array);
/*
OUTPUTS:
array(4) {
[0]=>
string(10) “”USDPHP=X””
[1]=>
string(6) “47.125”
[2]=>
string(11) “”10/3/2008″”
[3]=>
string(10) “”5:03pm”

}
*/

?>

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s