<?php

$from_Currency = urlencode('USD');
$to_Currency = urlencode('INR');
$encode_amount = 1;
$get = file_get_contents("https://finance.google.com/bctzjpnsun/converter?a=$encode_amount&from=$from_Currency&to=$to_Currency");
$get = explode("<span class=bld>",$get);
$get = explode("</span>",$get[1]);
$rate= preg_replace("/[^0-9\.]/", null, $get[0]);
$converted_amount = $amount*1;
$data = array( 'rate' => $rate, 'converted_amount' =>$converted_amount, 'from_Currency' => strtoupper($from_Currency), 'to_Currency' => strtoupper($to_Currency));
echo json_encode( $data );

?>
