sub getpage($$) {
my $link = shift;
my $base = shift;
my @site_content;
my $ua = LWP::UserAgent->new();
$ua->agent('Mozilla/5.0');
my $request = HTTP::Request->new('GET', $link);
my $response = $ua->request($request);
print "Retrieving http-page...\n";
if ( $response->is_error() ) {
$urls{$base}{'error'} = "Error code : ". $response->code() . "\n" .
"Error message: " . $response->message() . "\n";
return ();
}
else {
#print Dumper($response);
@site_content = split /\n/, $response->content();
$urls{$base}{'lasturl'} = $response->request->uri;
return @site_content;
}
}
all about go, ruby, python, perl, java, scala, osgi, RCP computing, network, hacking, security, encryption. and other interesting stuff
Freitag, 12. Juni 2009
PERL: get page with perl
a example
Abonnieren
Kommentare zum Post (Atom)
Keine Kommentare:
Kommentar veröffentlichen