1 2 3 4 5 6 7 8 9 10 11
#!/usr/bin/perl use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); my $url = "http://www.google.com/"; my $rsp = $ua->get($url); open (DATEI, ">code.html"); print DATEI "$rsp"; close (DATEI);
1 2 3 4 5 6
use LWP::Simple; my $url = "http://www.google.com/"; my $file = "code.html"; getstore($url, $file);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; my $url = "http://www.google.com/"; my $file="code.html"; my $ua = LWP::UserAgent->new(); my $rsp = $ua->get($url); if($rsp->is_success()) { open (my $fh, ">:raw", $file) or die "ERROR open $file ($!)"; print $fh $rsp->content(); close ($fh); } else { die $rsp->status_line(); }
2013-12-11T19:53:46 GwenDragonLWP inherits the methods of HTTP::Response.