CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Why lwp simple doesnt make google queries?

 



nekyian
New User

May 28, 2010, 2:38 AM

Post #1 of 1 (262 views)
Why lwp simple doesnt make google queries? Can't Post

I am having some trouble making google queries with lwp simple, on windows xp, with strawberry perl.

I will post the code below. I have tryed other urls and it works, it returns the object, just doesnt with google searches.



Code
#!/usr/bin/perl -w 


&funk('http://www.google.com/search?q=bananas', 'a', 'xXx');

sub funk {

use strict;
use HTML::Tree;
use LWP::Simple;

#die "nu am primit parametrii: 1 - url, 2 - clasa link, 3 - fisier de raportare(dc e nevoie)\n\n" unless (print $_[0]."\n" && print $_[1]."\n" && print $_[2]."\n");

my $content = get($_[0]) or die "am belito la get!";
my $tree = HTML::Tree->new();
$tree->parse($content);

my @links = $tree->look_down('class','titlu_site');

my $i = 0;
my @Kontent;
foreach (@links) {
print $_->as_text."\n";

my $url2get = 'http://'.$_->as_text;
$Kontent[$i] = get($url2get) or die "am belito la al doilea get!";

open (FILE, ">>log.txt");
print FILE $Kontent[$i];
close (FILE);

$i++;
}

}


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives