<?php
$xml = simplexml_load_file('http://www.tcmb.gov.tr/kurlar/today.xml');
foreach ($xml->Currency as $Currency) {
// USD ALIŞ-SATIŞ
if ($Currency['Kod'] == "USD") {
$usd_DS = $Currency->BanknoteSelling;
$usd_DA = $Currency->BanknoteBuying;
}
// EURO ALIŞ-SATIŞ
if ($Currency['Kod'] == "EUR") {
$eur_DS = $Currency->BanknoteSelling;
$eur_DA = $Currency->BanknoteBuying;
}
// USD EFEKTİF ALIŞ-SATIŞ
if ($Currency['Kod'] == "USD") {
$usd_ES = $Currency->ForexSelling;
$usd_EA = $Currency->ForexBuying;
}
// EURO EFEKTİF ALIŞ-SATIŞ
if ($Currency['Kod'] == "EUR") {
$eur_ES = $Currency->ForexSelling;
$eur_EA = $Currency->ForexBuying;
}
}
?>
<table>
<tr>
<td style="width: 200px;"><strong>Para Birimi</strong></td>
<td style="width: 50px;"><strong>Alış</strong></td>
<td style="width: 50px;"><strong>Satış</strong></td>
</tr>
<tr>
<td>Dolar (USD)</td>
<td><?php echo $usd_DS; ?></td>
<td><?php echo $usd_DA; ?></td>
</tr>
<tr>
<td>Euro (EUR)</td>
<td><?php echo $eur_DS; ?></td>
<td><?php echo $eur_DA; ?></td>
</tr>
<tr>
<td>Dolar (USD) Efektif</td>
<td><?php echo $usd_ES; ?></td>
<td><?php echo $usd_EA; ?></td>
</tr>
<tr>
<td>Euro (EUR) Efektif</td>
<td><?php echo $eur_ES; ?></td>
<td><?php echo $eur_EA; ?></td>
</tr>
</table>