Hi all gurus in tha club,
I scripted a prog that extract a string from an html page excluding
all the tags.
The problem is that it works quite slowly and I wanted to know if
somebody of us as an idea how to improve his performance.
Thanks a lot
SHE
CODE
$start="start_str"; //begin string
$end="end_str"; //end string
if($snoopy->fetch("http://www.informative.page.com";)) //get the html
code
{
$string=$snoopy->results; //assign to $string all the html string
- Hide quoted text -
$i=1;
$line = explode("\n", $string); //trim the html in lines
while ($i<300)
{
//take only the middle
if ($i>230) {
//explode the line to control the content
$piece = explode(" ", $line[$i]);
$k=0;
while ($k<200) {
//if it content the string that i'm searching... :)
if ($piece[$k] == "interesting_part") {
$word=preg_split("/[\s<>]+/", $line[$i]); //to eliminate html tags
$j=1;
$flag=0; //to say when print the word
//extract the string without html
while ($word[$j]) {
if ($word[$j] == $begin) $flag = 1;
if ($word[$j] == $stop) $flag = 0;
if ($flag) echo "$word[$j] ";
$j++;
}
}
$k++;
}
}
$i++;
}
}
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG