Arquivo 1(index.php): ".$procura."
"; $pageNeed=1; for($n=0;$n<$pageNeed;$n++) { echo "Página---".($n+1)."
"; $spider=new googleCrawler($procura,$n); $spider->getGoogleDivs(); $links=$spider->getGoogleLinks(); $titles=$spider->getGoogleTitles(); $descriptions=$spider->getGoogleDescriptions(); for($i=1;$i<(count($links))+1;$i++) { echo "
".$titles[$i]."
"; echo $descriptions[$i]."

"; } } ?> Arquivo 2(classe.php): 0) $keywords=str_replace(' ','+',$keywordsGot); else $keywords=$keywordsGot; if($pageNum==0) $this->content=file_get_contents("http://www.google.com/search?q=".$keywords); else { $index=($pageNum*10); $this->content=file_get_contents("http://www.google.com/search?q=".$keywords."&start=".$index); } } function getGoogleDivs() { $j = 0; for ($i=0;$i<=strlen($this->content);$i++) { if (substr($this->content,$i,strlen('
')+1; $k=$i; while (substr($this->content,$k,strlen('
'))!='') { $k++; } $en=$k+strlen(''); $this->divs[$j]=substr($this->content,$st,$en-$st); } } } function getGoogleLinks() { for($n=1;$ndivs)+1;$n++) { for ($i=0;$i<=strlen($this->divs[$n]);$i++) { if (substr($this->divs[$n],$i,strlen('

'))=='

') { $st=$i+strlen('

divs[$n],$st,$en-$st); } } } return $links; } function getGoogleTitles() { for($n=1;$ndivs)+1;$n++) { for ($i=0;$i<=strlen($this->divs[$n]);$i++) { if (substr($this->divs[$n],$i,strlen('

'))=='

') { $st=$i+strlen('

'))!='') { $k++; } $en=$k; $allParts[$n]=substr($this->divs[$n],$st,$en-$st)."end$"; } } } for($n=1;$n','',$allParts[$n]); $withoutBold[$n]=str_replace('','',$withoutB); } for($n=1;$n'))=='>') { $st=$i+1; $k=$i; while (substr($withoutBold[$n],$k,strlen('end$'))!='end$') { $k++; } $en=$k; $titles[$n]=substr($withoutBold[$n],$st,$en-$st); } } } return $titles; } function getGoogleDescriptions() { for($n=1;$ndivs)+1;$n++) { for ($i=0;$i<=strlen($this->divs[$n]);$i++) { if (substr($this->divs[$n],$i,strlen(''))=='') { $st=$i+strlen(''); $k=$i; while (substr($this->divs[$n],$k,strlen(''))!='') { $k++; } $en=$k; $descriptions[$n]=substr($this->divs[$n],$st,$en-$st); } } } return $descriptions; } } ?>