Login   Register  
PHP Classes
elePHPant
Icontem

File: googleCrawler.sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Bari Hossain  >  Google Crawler  >  googleCrawler.sample.php  >  Download  
File: googleCrawler.sample.php
Role: Example script
Content type: text/plain
Description: this the sample page which includes the googleCrawler class and get the links,titles and descriptions from that class
Class: Google Crawler
Extract results from Google search pages
Author: By
Last change: small problem.a problem in the variable name.sorry for the problem.
Date: 7 years ago
Size: 710 bytes
 

Contents

Class file image Download
<?php
include "googleCrawler.class.php";


$keywordsGot="Cricket";//write the keywords here for search
echo "Search Results for  <b>".$keywordsGot."</b><br>";




    
$pageNeed=1;//enter here how many pages you want to crawl

    
for($n=0;$n<$pageNeed;$n++)
    {    
        echo 
"In Page---<b>".($n+1)."</b><br>";
    
        
$spider=new googleCrawler($keywordsGot,$n);

    
        
        
$spider->getGoogleDivs();
        
$links=$spider->getGoogleLinks();
        
$titles=$spider->getGoogleTitles();
        
$descriptions=$spider->getGoogleDescriptions();
            
        for(
$i=1;$i<(count($links))+1;$i++)
        {            
            echo 
"<div><a href=\"".$links[$i]."\">".$titles[$i]."</a><br>";
            echo 
$descriptions[$i]."</div><br>";    
                    
        }
    }
?>