Unable to load URL!");
$data=implode($file);
$cache = fopen("../tmp/regexptest.tmp","w");
fwrite($cache, $data);
fclose($cache);
}
else
{
echo "file ../tmp/".$url." already exists in cache, using it.";
$data=file("../tmp/regexptest.tmp");
}
echo "applying $grep...";
preg_match_all($grep,$data,$res,PREG_SET_ORDER);
print_r($res);
$index = 1;
foreach ($res as $elt)
{
if ($elt[1] != "" && $elt[2] != "")
{
$niouzes[$index]["link"] = $elt[1];
if (file_exists($baseurl.$elt[1]))
{
$dataitem = implode("",file($baseurl.$elt[1]));
$dataitem = strtr($dataitem,"\n\0\r"," ");
$dataitem = trim($dataitem);
if (isset($grepitemdate))
{
preg_match_all($grepitemdate,$dataitem,$resitem,PREG_SET_ORDER);
$niouzes[$index]["date"] = $resitem[0][1];
}
else
$niouzes[$index]["date"] = "unknown";
if (isset($grepitemsummary))
{
preg_match_all($grepitemsummary,$dataitem,$resitem,PREG_SET_ORDER);
if (strlen(strip_tags($resitem[0][1])) > 200)
$niouzes[$index]["summary"] = substr(strip_tags($resitem[0][1]), 0, 200)."...";
else
$niouzes[$index]["summary"] = strip_tags($resitem[0][1]);
}
else
$niouzes[$index]["summary"] = "unknown";
if (isset($author))
{
$niouzes[$index]["author"] = $author;
}
else if (isset($grepitemauthor))
{
preg_match_all($grepitemauthor,$dataitem,$resitem,PREG_SET_ORDER);
$niouzes[$index]["author"] = $resitem[0][1];
}
else
$niouzes[$index]["author"] = "unknown";
}
$niouzes[$index]["title"] = trim($elt[2]);
}
echo "".$niouzes[$index]["title"]."
";
$index++;
}
?>