This is the code :
Code: Select all
$file = fopen("http://www.bnro.ro/Ro/Info/", "r");
$tarih = date('Y.m.d');
$today = date("d-m-Y");
$numeValuta = array("Euro","Dolarul SUA");
while (!feof($file)){
$line = fgets($file, 1024);
if (eregi('<TD class="bold">(.*)</TD>', $line, $out)) {
$cursvalutar = each($out);
while (list($key,$val) = each($numeValuta)){
if ($val == "Euro") {
$euro = str_replace(',','.',$cursvalutar[1]);
}
if ($val == "Dolarul SUA"){
$dolar = str_replace(',','.',$cursvalutar[1]);
}
break;
}
}
}
fclose($file);
$sql=mysql_query("select * from currncy where crrn_name='ron' and tarih='$tarih'");
if(mysql_num_rows($sql) == 0) {
mysql_query("INSERT INTO currncy VALUES('','$tarih','ron','$euro')") or die(mysql_error());}Code: Select all
echo $euro;Note : My field type is decimal(5,2) for this value on the respective table. But parse value is 3.7694 or something like this. may it be reason of the problem?