use LWP::UserAgent; sub get_url( $ ) { my ( $url ) = @_; my $ua = LWP::UserAgent->new(); # $ua->proxy('http','http://proxy.company.com:8080/'); $ua->timeout( 10 ); my $resp = $ua->get($url); if ( $resp->is_success ) { return( $resp->content ); } else { die( "LWP error: " . $resp->status_line . "\n" ); } } print( get_url( 'http://www.perl.com/' ) );
In reply to Re: Getting contents of URL
by monarch
in thread Getting contents of URL
by perl_devel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |