in reply to Getting contents of URL
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/' ) );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getting contents of URL
by perl_devel (Friar) on Jul 28, 2005 at 04:56 UTC | |
by jbrugger (Parson) on Jul 28, 2005 at 05:10 UTC |