Hi,
I try to get some data from a web page which includes daily Exchange rates. As far as I understand there are two tables in the web page, I can get the data in the first table, but from the second table there is no data come out. Let me clarify myself; with “feof” and “fgets” functions I can get the data like USD/TRY, AUD/TRY, EUR/TRY. But “feof” terminates to read the file after reading numbers of PKR/TRY, although there are more data on the file such as USD/ AUD, USD/DKK, USD/CHF, … I am using the following script. In my opinion there is no error on the script, but maybe I should use some other function instead of “feof”. :-\ My goal is to get the Cross Rates data such as USD/AUD, EUR/USD. Please help me to solve my problem. Thanks for your help in advance.
$link=fopen(“http://www.tcmb.gov.tr/kurlar/today.xml","r”) or die (“Page Error”);
while (!feof($link)) {
$line1= fgets($link, 4096);
if ($place1=strpos($line1, “EUR/USD”)===false)
{
}
else {
$yer1=strpos($line1,“EUR/USD”);
echo $line1;
$usdavrovalue=substr($line1,$place1,92);
echo $usdavrovalue;
break;
}
}
fclose($link);