in reply to Re^5: WGET equivalent
in thread WGET equivalent
#!/usr/local/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser carpout); use lib qw(/usr/lib/perl5/vendor_perl/5.8.6/LWP /usr/lib/perl5/vendor_ +perl/5.8.6 / /usr/lib/perl5/vendor_perl/5.8.6/LWP/UserAgent.pm); use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->agent('Mozilla/5.0'); my $current_page = "http://www.perlmonks.org"; my $response = $ua->get($current_page); my $data = $response->content if($response->is_success) or die "not su +ccessful $!\n"; if($data){ print "page: $current_page\n$data\ndone", length($data); } else { print "no data\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: WGET equivalent
by moritz (Cardinal) on Feb 04, 2008 at 17:32 UTC | |
|
Re^7: WGET equivalent
by Corion (Patriarch) on Feb 04, 2008 at 17:33 UTC |