strings and search
Posted: Tue May 20, 2008 6:32 am
Hello,
My mother lang is not English and I am sorry on the mistakes .
I am working on a searching robot.
I have a little problem showing the result.
this is the base code:
The problem is that he is searching all over the page..include HTML code..
And I dont want him to search in the HTML code...
how do i fix it?
Ty
My mother lang is not English and I am sorry on the mistakes .
I am working on a searching robot.
I have a little problem showing the result.
this is the base code:
Code: Select all
$file =file_get_contents($url);
if (strstr($file2,$word[$i]))
{
$ex = strstr($file ,$word[$i]);//find the word in the text
$num = strlen($word[$i]);//the size of the word i am looking(in int)
$pri = substr($ex , 0 , $num);// return $num charts from the the $file
$pri2 = substr($ex , 0 , 20);// return 20 charts from the the $file
$line = STRPOS($file,$word[$i]);// line number of the word
echo " The word '<b>{$word[$i]}</b>' found in line $line";
echo "<pre> the full sentance : '<b>$pri2</b>'<br></pre>";
}
else
{
echo "The word {$word[$i]} wasnt found in the page <b>$url</b>";
}
And I dont want him to search in the HTML code...
how do i fix it?
Ty