programming-examples/perl/Network/Setting a User Agent and Retrieving a Web Page.pl

10 lines
275 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl -w
use LWP;
use strict;
my $browser = LWP::UserAgent->new(agent => 'Perly v1');
my $result = $browser->get("http://www.braingia.org/ewfojwefoj");
die "An error occurred: ", $result->status_line() unless $result->is_success;
print $result->content;