bnadesan has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use LWP::UserAgent; $ua = LWP::UserAgent->new; $ua->agent("Mozilla/5.0"); # pretend we are very capable browser $req = HTTP::Request->new(GET => 'http://www.yahoo.com'); $req->header('Accept' => 'text/html'); # send request $res = $ua->request($req); # check the outcome if ($res->is_success) { print $res->content; } else { print "Error: " . $res->status_line . "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Get URL perl program
by Fletch (Bishop) on Dec 15, 2004 at 15:26 UTC | |
|
Re: Get URL perl program
by gellyfish (Monsignor) on Dec 15, 2004 at 15:29 UTC | |
|
Re: Get URL perl program
by ysth (Canon) on Dec 15, 2004 at 16:00 UTC |