Hi,
I'am fiddling around with the LWP Class, wrote myself a program which
sends a query to altavista.
When I search altavista for dummie it returns 33.200 hits, when I use
perl it returns 33,100 hits. Any suggestions where are the 100 missing
hits.
Rene
#!/usr/bin/perl
##---------------------------------------------------------------------------
# altavisata.pl
#
#
#----------------------------------------------------------------------------
use strict;
use warnings;
use LWP;
use URI::Escape;
my $browser;
sub do_GET {
# parameters: the url
# and then optionally , any headerlines (key,value,key,value)
$browser=LWP::UserAgent->new() unless $browser;
my $resp=$browser->get(@_);
return ($resp->content,$resp->status_line, $resp->is_success, $resp)
if wantarray;
return unless $resp->is_success;
return keep->content;
}
foreach my $word(@ARGV) {
next unless $word;
my $savequery=uri_escape($word);
my
$url="http://www.altavista.com/web/results?itag=wrx&q=$savequery&kgs=1&kls=0";
my ($content,$status,$is_success)=do_GET($url);
$content=~/(AltaVista found)\s([0-9,]+)/;
print "$word :"," ",$1," ",$2," results","\n";
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>