
nekyian
New User
May 28, 2010, 2:38 AM
Post #1 of 1
(143 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.
#!/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++; } }
|