index.php dosyanızın içinden aşağıdaki kodları silin.
function tcmb($bakilacak,$site){
$dosya = @fopen($site, "r");
if ($dosya) {
$geldi = false;
while(!feof($dosya)) {
$satir = fgets($dosya,512);
$code = substr($satir, 0, 3);
if (($code == $bakilacak) && ($geldi == false)) {
$geldi = true;
$sonuc = split("[[:space:]]+" , $satir);
$doviz[0] = substr($sonuc[3], 0, 9);
$doviz[1] = substr($sonuc[4], 0, 9);
$doviz[2] = substr($sonuc[5], 0, 9);
$doviz[3] = substr($sonuc[6], 0, 9);
$doviz[4] = substr($sonuc[7], 0, 9);
}
} // while
return $doviz;
} // if($dosya)
}// function
$usd_doviz = tcmb('USD','http://www.tcmb.gov.tr/kurlar/today.html');
$eur_doviz = tcmb('EUR','http://www.tcmb.gov.tr/kurlar/today.html');yerine aşağıdaki kodları yazın;
$link ="http://www.tcmb.gov.tr/kurlar/today.xml";
$tcmb_sayfasi = file_get_contents($link);
preg_match('#<CurrencyName>US DOLLAR</CurrencyName><ForexBuying>(.*?)</ForexBuying>#si',$tcmb_sayfasi,$dolar_alis);
$dolar_alis = $dolar_alis[1] ;
preg_match('#CurrencyName>US DOLLAR</CurrencyName><ForexBuying>(.*?)</ForexBuying><ForexSelling>(.*?)</ForexSelling>#si',$tcmb_sayfasi,$dolar_satis);
$dolar_satis = $dolar_satis[2] ;
preg_match('#<Isim>EURO</Isim><CurrencyName>EURO</CurrencyName><ForexBuying>(.*?)</ForexBuying>#si',$tcmb_sayfasi,$euro_alis);
$euro_alis = $euro_alis[1] ;
preg_match('#<Isim>EURO</Isim><CurrencyName>EURO</CurrencyName><ForexBuying>(.*?)</ForexBuying><ForexSelling>(.*?)</ForexSelling>#si',$tcmb_sayfasi,$euro_satis);
$euro_satis = $euro_satis[2] ;Ardından aşağıdaki kodu bulun
<td width="87" align="left" valign="middle" class="index_doviz_yazi">USD Alış: </td>
<td width="59" align="left" valign="middle" class="index_doviz_yazi1"> <?=$usd_doviz[1];?> </td>
<?=$usd_doviz[1];?> yerine <?php echo $dolar_alis; ?> yazın
Son maddeyi dolar satış, euro alış ve euro satış için tekrarlayın.
$dolar_satis
$euro_alis
$euro_satis