So I have this code below but I am wondering how I can tell if '$text' contains the words 'by owner'. How do I do this? I looked around but I can't find anything.
foreach($anchors as $a) {
$i = $i + 1;
$text = $a->nodeValue;
$href = $a->getAttribute('href');
if ($i > 22 && $i < 64 && ($i % 2) == 0) {
//if ($i<80) {
echo "<a href =' ".$href." '>".$text."</a><br/>";
}
// }
//$str = file_get_contents($href);
//$result = (substr_count(strip_tags($str),"ipod"));
//echo ($result);
}
$text
has the substring"by owner"
? Cause php.net/manual/en/function.strstr.php will do that... If you need case insensitivity, use php.net/manual/en/function.stristr.php . And php.net/manual/en/function.preg-match.php will allow you to use regular expressions to match variable spacing, exact words, etc.