How to Currency convert / Indian Rupees using php. You have convert between that currency and all other currencies. Following code using easy convert to Currency / Indian Rupees.
<?php
function currency($from_Currency,$to_Currency,$amount)
{
$amount = urlencode($amount);
$from_Currency = urlencode($from_Currency);
$to_Currency = urlencode($to_Currency);
$url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency";
$result = file_get_contents($url);
$result = explode('"', $result);
//print_r($result);
$converted_amount = explode(' ', $result[3]);
//print_r($converted_amount);
$conversion_a = $converted_amount[0];
// $conversion_f= round($conversion_a, 0);
$conversion_f=$conversion_a;
return $conversion_f;
}
/* CURRENCY name code && fullname */
/* Code - CURRENCY name */
/*
CAD - Canadian Dollar
CHF - Swiss Franc
CNY - Chinese Yuan Renminbi
DKK - Danish Krone
EUR - Euro
GBP - British Pound
HKD - Hong Kong Dollar
HUF - Hungarian Forint
INR - Indian Rupee
JPY - Japanese Yen
MXN - Mexican Peso
MYR - Malaysian Ringgit
NOK - Norwegian Krone
NZD - New Zealand Dollar
PHP - Philippine Peso
RUB - Russian Ruble
SEK - Swedish Krona
SGD - Singapore Dollar
THB - Thai Baht
TRY - Turkish Lira
USD - US Dollar
ZAR - South African Rand */
/* End here */
/* For Examples 1 */
$from_Currency="USD"; //
$to_Currency="INR";
$number_of_value=1; //Number of value convert
echo $number_of_value." ".$from_Currency." Dollar Convert ".$to_Currency." (indian Rupee): ".currency($from_Currency,$to_Currency,$number_of_value).$to_Currency."<br><br>";
/* For Examples 2 */
$from_Currency="EUR";
$to_Currency="INR";
$number_of_value=1;
echo $number_of_value." ".$from_Currency." Convert ".$to_Currency." (indian Rupee): ".currency($from_Currency,$to_Currency,$number_of_value).$to_Currency."<br><br>";
/* For Examples 3 */
$from_Currency="INR";
$to_Currency="USD";
$number_of_value=100;
echo $number_of_value." ".$from_Currency."(indian Rupee) Convert ".$to_Currency." (Dollar): ".currency($from_Currency,$to_Currency,$number_of_value).$to_Currency."<br><br>";
?>
<?php
function currency($from_Currency,$to_Currency,$amount)
{
$amount = urlencode($amount);
$from_Currency = urlencode($from_Currency);
$to_Currency = urlencode($to_Currency);
$url = "http://www.google.com/ig/calculator?hl=en&q=$amount$from_Currency=?$to_Currency";
$result = file_get_contents($url);
$result = explode('"', $result);
//print_r($result);
$converted_amount = explode(' ', $result[3]);
//print_r($converted_amount);
$conversion_a = $converted_amount[0];
// $conversion_f= round($conversion_a, 0);
$conversion_f=$conversion_a;
return $conversion_f;
}
/* CURRENCY name code && fullname */
/* Code - CURRENCY name */
/*
CAD - Canadian Dollar
CHF - Swiss Franc
CNY - Chinese Yuan Renminbi
DKK - Danish Krone
EUR - Euro
GBP - British Pound
HKD - Hong Kong Dollar
HUF - Hungarian Forint
INR - Indian Rupee
JPY - Japanese Yen
MXN - Mexican Peso
MYR - Malaysian Ringgit
NOK - Norwegian Krone
NZD - New Zealand Dollar
PHP - Philippine Peso
RUB - Russian Ruble
SEK - Swedish Krona
SGD - Singapore Dollar
THB - Thai Baht
TRY - Turkish Lira
USD - US Dollar
ZAR - South African Rand */
/* End here */
/* For Examples 1 */
$from_Currency="USD"; //
$to_Currency="INR";
$number_of_value=1; //Number of value convert
echo $number_of_value." ".$from_Currency." Dollar Convert ".$to_Currency." (indian Rupee): ".currency($from_Currency,$to_Currency,$number_of_value).$to_Currency."<br><br>";
/* For Examples 2 */
$from_Currency="EUR";
$to_Currency="INR";
$number_of_value=1;
echo $number_of_value." ".$from_Currency." Convert ".$to_Currency." (indian Rupee): ".currency($from_Currency,$to_Currency,$number_of_value).$to_Currency."<br><br>";
/* For Examples 3 */
$from_Currency="INR";
$to_Currency="USD";
$number_of_value=100;
echo $number_of_value." ".$from_Currency."(indian Rupee) Convert ".$to_Currency." (Dollar): ".currency($from_Currency,$to_Currency,$number_of_value).$to_Currency."<br><br>";
?>
Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share. convert money online
ReplyDelete