çok teşekkür ederim hocam bununla sonuç aldım.
şu şekilde de olabilir:
<?php
$cache_timeout = 43200;
$file = 'today.xml';
function getCurrency($x){
global $cache_timeout;
global $file;
if(!file_exists($file)){
file_put_contents($file, file_get_contents('http://www.tcmb.gov.tr/kurlar/today.xml'));
}
if(filemtime($file)+$cache_timeout<time()){
file_put_contents($file, file_get_contents('http://www.tcmb.gov.tr/kurlar/today.xml'));
}
$get = file_get_contents($file);
$xml=simplexml_load_string($get);
return $xml->xpath('Currency[@CurrencyCode="'.$x.'"]')[0]->BanknoteSelling;
}
echo getCurrency('USD');
?>