2007/10/8, Patrik Hasibuan <[EMAIL PROTECTED]>: > But if I retrieve a little bit more complicated url such as > "http://www.google.com/search?q=silicon+valley&start=20" causes error. > > I need to retrieve this url: > http://www.google.com/search?q=silicon+valley&start=20. I use "silicon > valley" as the keyword. >
Hi, Try this way below (got from perldoc lwpcook),it can work for me. use strict; use LWP::UserAgent; my $uri = 'http://www.google.com/search?q=silicon+valley&start=20'; my $ua = LWP::UserAgent->new; $ua->agent("Mozilla/8.0"); # pretend we are very capable browser my $req = HTTP::Request->new(GET => $uri); $req->header('Accept' => 'text/html'); # send request my $res = $ua->request($req); # check the outcome if ($res->is_success) { print $res->content; } else { print "Error: " . $res->status_line . "\n"; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/