문제

I am running

#!/usr/bin/perl -w
use strict;
use LWP::Simple;
도움이 되었습니까?

해결책

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' );

다른 팁

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.';
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top