Searching results for "'.$srch.'"');
$files = glob("*.html");
foreach ($files as $ff ){
if( strpos(file_get_contents($ff),$srch) !== false) {
$title = page_title($ff);
if ($fnd != 0 ){
echo(' - ' . '
'.$title.'');
}
else
{
echo('
'.$title.'');
};
$fnd=1;
// do stuff
}
};
if($fnd == 0){
echo('
Sorry There is No Match');
}
}else{
// echo('
Searching Result
)';
} ;
function page_title($url) {
$fp = file_get_contents($url);
if (!$fp)
return null;
$res = preg_match("/
(.*)<\/title>/siU", $fp, $title_matches);
if (!$res)
return null;
// Clean up title: remove EOL's and excessive whitespace.
$title = preg_replace('/\s+/', ' ', $title_matches[1]);
$title = trim($title);
return $title;
}
?>