I am a newbie to php and I would like to create php search apps.
My Follow code
<?php
$html = file_get_contents("folder/one.html");
if (strpos($html, "searchtext") !== false) {
echo "found";
} else {
echo "not found";
}
?>
Is it possible to search for multiple files???
My hard code method
<?php
$url1 = "folder/one.html";
$html1 = file_get_contents($url1);
if (strpos($html1, "searchtext") !== false) {
echo "found it from folder/one.html";
}
$url2 = "folder/two.html";
$html2 = file_get_contents($url2);
if (strpos($html2, "searchtext") !== false) {
echo "found it from folder/two.html";
}
......loop
$url9999 = "folder/ninethousandninehundredninety-nine.html";
$html9999 = file_get_contents($url9999);
if (strpos($html9999, "searchtext") !== false) {
echo "found it from folder/ninethousandninehundredninety-nine.html";
}
?>
anyidea how to use file_get_contents() to search multiple files? Thank you very much