in reply to Re: LWP post
in thread LWP post
I hope this was useful.use URI; use LWP::UserAgent; my $what_i_want_to_find = 'perl monks'; $ua = LWP::UserAgent->new; # google doesn't like it when user agent is libwww perl, so # I change it to Mozilla/5.0 $ua->agent('Mozilla/5.0'); my $uri = URI::new; $uri->query_form('q'=>$what_i_want_to_find); my $url = 'http://www.google.com/search' . $uri->as_string; my $req = HTTP::Request->new(GET => $url); my $res = $ua->request($req)->as_string; $res =~ /\<p\>\<a href\=([^>]+)\>/; print $1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: LWP post
by Anonymous Monk on Jun 18, 2002 at 16:13 UTC | |
by moxliukas (Curate) on Jun 18, 2002 at 17:01 UTC | |
by dsheroh (Monsignor) on Jun 18, 2002 at 23:55 UTC |