I have the following which checks a list of keywords against urls:
function searchUrls()
{
$result = array();
$urlList = file("link_to.txt");
$keywordList = explode("
", file_get_contents("link_to.txt"));
for($index = 0; $index <count($urlList); $index++)
{
$urlList[$index] = str_replace("
", "", $urlList[$index]);
$data = file_get_contents("$urlList[$index]");
$keywords = array();
foreach($keywordList as $keyword)
{
if (stripos($data, $keyword) !== false)
{
$keywords[] = $Keyword.'found';
}
}
$result[] = array('url' => $urlList[$index], 'status' => $keywords);
}
return $result;
}
when echo-ing out
foreach($result['status'] as $keyword)
only the 'found'is printing.
on
var_dump($results)
the variable isn't stored in the array but the text is?
How can this work to echo out the variable as well as the text?
Many thanks