Bu Javascript (jQuery) için hazırladığım bir koddu.
function getDoviz(){
$.getJSON('http://api.bigpara.hurriyet.com.tr/doviz/headerlist/anasayfa', function(json, textStatus) {
console.log(json);
jQuery.each(json.data, function(index, val) {
var t = json.data;
if ( t[index].SEMBOL == "USDTRY" ) {
if ( t[index].YUZDEDEGISIM > 0 ) {
$("#dolarTrend").append('<i class="fa fa-arrow-up" style="color: #00ff85;" title="Trend Yukarı"></i> ');
} else {
$("#dolarTrend").append('<i class="fa fa-arrow-down" style="color: #FF0000;" title="Trend Aşağı"></i> ');
}
$("#dolar").append(t[index].SATIS);
}
if ( t[index].SEMBOL == "EURTRY" ) {
if ( t[index].YUZDEDEGISIM > 0 ) {
$("#euroTrend").append('<i class="fa fa-arrow-up" style="color: #00ff85;" title="Trend Yukarı"></i> ');
} else {
$("#euroTrend").append('<i class="fa fa-arrow-down" style="color: #FF0000;" title="Trend Aşağı"></i> ');
}
$("#euro").append(t[index].SATIS);
}
if ( t[index].SEMBOL == "GLDGR" ) {
if ( t[index].YUZDEDEGISIM > 0 ) {
$("#altinTrend").append('<i class="fa fa-arrow-up" style="color: #00ff85;" title="Trend Yukarı"></i> ');
} else {
$("#altinTrend").append('<i class="fa fa-arrow-down" style="color: #FF0000;" title="Trend Aşağı"></i> ');
}
$("#altin").append(t[index].SATIS);
}
});
});
}
getDoviz();Aşağıdaki de PHP ile
<?php
$url = 'http://api.bigpara.hurriyet.com.tr/doviz/headerlist/anasayfa';
$cekVeri = file_get_contents($url);
$gelenVeri = json_decode($cekVeri);
foreach($gelenVeri->data as $veri){
if($veri->SEMBOL == 'USDTRY'){
echo 'Dolar alış: '.$veri->ALIS.'<br>';
}
}
?>Örnekler burada. Kendine göre düzenlersin biraz bilgin varsa.
Kolay gelsin.