Help with Snoopy PHP class

Discussion in 'PHP' started by robokoder, Jun 27, 2008.

  1. #1
    I was wondering if anybody has a decent tutorial for Snoopy PHP class which I don't really understand. It lets a script navigate around a website automatically.

    I really want to see how to go through successive forms- i.e. a sample code which will search 'test' in google, then search 'test2' on the resulting page, and then be able to scrape some data from the final page. (I know this can be done more easily without Snoopy, but it is just proof-of-concept)

    If anybody could help me out, I would be VERY grateful.

    Cheers all
     
    robokoder, Jun 27, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
  3. robokoder

    robokoder Peon

    Messages:
    146
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for looking, but I did have a hunt around and that doesnt have any form input.

    Anyway, I managed it myself some how :D

    But thanks anyway
     
    robokoder, Jun 27, 2008 IP
  4. juust

    juust Peon

    Messages:
    214
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    it would be something like this :

    
    include('Snoopy.class.php');
    $varkeywords = "le+roi+c'est+moi";
    $s = new Snoopy;
    $googleurl = "http://www.google.com/search?as_q=".urlencode(trim($varkeywords))."&num=50&start=1&hl=en&lr=lang_en";
    
    $s->fetchlinks($googleurl);
    $myresults = $s->results;
    echo count($myresults)." results <br />";
    
    for($x=0;$x<count($myresults);$x++) {
         unset($s);
         $s = new Snoopy;
         $s->fetchtext($myresults[$x]);
         print_r($s->results);
    	 flush();
    }
    
    PHP:
    a google page has serp-links and cra*-links,
    and Snoopy don't distinguish so the best solution it to not use Snoopy.
     
    juust, Jun 27, 2008 IP