in reply to Retrieviing HTML with LWP::UserAgent
All I can say is that it works fine for me. That sure is a lot of preceeding whitespace, but I get everything nonetheless. Maybe try stripping the whitespace? Other than that, try giving us some more information if you can?
print retrieve_url( 'http://www.finasta.lt' ); # note - don't use the parentheses after the sub name # we're not needing prototypes here sub retrieve_url { my $url = shift; my $ua = LWP::UserAgent->new(); my $res = $ua->get( $url ); if ( $res->is_success() ) { my $content = $res->content(); $content =~ s!\A\s+!!; return( $content ); } else { die( "retrieval error: ", $res->status_line() ); } }
|
|---|