Yahoo Finance Döviz Kuru Çevirme Sınıfı

<?php
class Kurlar{
	function Donustur($miktar,$bundan,$buna){
		$url="http://adsynth-ofx-quotewidget-prod.herokuapp.com/api/1";
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL,$url);
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, '{"method":"spotRateHistory","data":{"base":"'.$bundan.'","term":"'.$buna.'","period":"week"}}');
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
		curl_setopt($ch, CURLOPT_REFERER, "https://widget-yahoo.ofx.com/");
		$html = curl_exec ($ch);
		curl_close ($ch);
		$veri=json_decode($html,true);
		return $veri["data"]["CurrentInterbankRate"]*$miktar;
	}
}
$kur = new Kurlar();
echo $kur->Donustur(1, 'USD', 'TRY');
?>

Çıktısı

4.4143