Why doesn't LWP get html file?
- From: trymelz@xxxxxxxxx
- Date: Thu, 26 Jun 2008 12:51:00 -0700 (PDT)
$html has nothing from the following code. Could someone help me?
Thanks.
use LWP;
use URI;
$Browser = LWP::UserAgent->new || die "$!";
my $Surfurl = 'http://us.randstad.com/webapp/internet/servlet/
BranchView?b=702';
my @ns_headers = (
'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.1.11) Gecko/20071127',
'Accept' => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
image/png, */*',
'Accept-Charset' => 'iso-8859-1,*,utf-8',
'Accept-Language' => 'en-US',
);
my $response = $Browser->get( $Surfurl, @ns_headers );
die "Can't get $url -- ", $response->status_line unless $response-
is_success;die "Hey, I was expecting HTML, not ", $response->content_type unless
$response->content_type eq 'text/html';
my $html = $response->decoded_content;
print $html;
print "program finished";
.
- Follow-Ups:
- Re: Why doesn't LWP get html file?
- From: Rob Dixon
- Re: Why doesn't LWP get html file?
- From: Gunnar Hjalmarsson
- Re: Why doesn't LWP get html file?
- Prev by Date: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?
- Next by Date: Re: parsing a tree like structure
- Previous by thread: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?
- Next by thread: Re: Why doesn't LWP get html file?
- Index(es):