<html>

<head>
  <title>STEP-2</title>
</head>

<body>

<?php
require "./settings.inc";
$fp = @fopen("./processed.txt", "rt");
$fp2 = @fopen("db.txt", "w");
$ff=0;
$ff=0;
if ($fp) {
while(!feof($fp)) {
$url=trim(fgets($fp));
if($url!="") {
$fp3=fopen("./processed/".$url,"rt");
$cont=trim(fread($fp3,@filesize("./processed/".$url)));
fclose($fp3);

if($cont!="") {
unset($product);
$product = parse_html($cont);
if($product["name"]!="") {
if($product["price"]>0) {
fputs($fp2,utf8win1251(implode("|",$product))."|\n");
$ff++;
}
}
}
}
echo "\n";

}
fclose($fp2);
fclose($fp);
}
echo "<h2>Total items: $ff</h2>";
?>
<h1>OK</h1>
</body>

</html>