The variable $site
has the html
code.
Also you can use the function getstore
to save the html
data to a file, like:
my $http_code = getstore( 'http://www.google.com/', 'google.html' );
Question
I am running
#!/usr/bin/perl -w
use strict;
use LWP::Simple;
Solution
The variable $site
has the html
code.
Also you can use the function getstore
to save the html
data to a file, like:
my $http_code = getstore( 'http://www.google.com/', 'google.html' );
OTHER TIPS
It would help you a lot if you could see the reason for the failure. I suggest you use the core LWP
instead of the simple version. Like this:
#!/usr/bin/perl
use strict;
use warnings;
use LWP;
my $ua = LWP::UserAgent->new;
my $response = $ua->get('http://www.google.com/');
die 'Couldn't get it: ', $response->status_line unless $response->is_success;
my $site = $response->decoded_content;
print 'Got it.';