<?
error_reporting(E_ALL);
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[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');
$gbp_doviz = tcmb('GBP','http://www.tcmb.gov.tr/kurlar/today.html');
?>
<table>
<tr align="center">
<td><font size="1" face="verdana" color="red"><b>USD Alış</b></font></td>
<td><font size="1" face="verdana" color="red"><b>USD Satış</b></font></td>
<td><font size="1" face="verdana" color="red"><b>EURO Alış</b></font></td>
<td><font size="1" face="verdana" color="red"><b>EURO Satış</b></font></td>
<td><font size="1" face="verdana" color="red"><b>Sterlin Alış</b></font></td>
<td><font size="1" face="verdana" color="red"><b>Sterlin Satış</b></font></td>
<tr>
<tr align="center">
<td><font size="1" face="arial"><?=$usd_doviz[3];?></font></td>
<td><font size="1" face="arial"><?=$usd_doviz[4];?></font></td>
<td><font size="1" face="arial"><?=$eur_doviz[3];?></font></td>
<td><font size="1" face="arial"><?=$eur_doviz[4];?></font></td>
<td><font size="1" face="arial"><?=$gbp_doviz[3];?></font></td>
<td><font size="1" face="arial"><?=$gbp_doviz[4];?></font></td>
<tr>
</table>