[EMAIL PROTECTED] <[EMAIL PROTECTED]> asked:
> Can someone assist me in modifying the the script below to support the
> following:
> 
> 1)define proxy server
> 2)the URL being accessed via LWP is protected, so I need to 
> specify username/passwd combo

This is OTTOMH:

use LWP::UserAgent; # instead of use LWP::Simple;

# See LWP::UserAgent manpage for other constructor options
my $ua = new LWP::UserAgent(timeout => 60);

# Set up the HTTP proxy you're going to use
$ua->proxy(['http'], 'http://my.proxy.dom:8001/');

my $realm = 'Whatever the Webserver sends as the login prompt text';

#Set up login credentials
$ua->credentials( 'presto.capricorn.com', $realm, $uname, $pass );

my $response = $ua->head( $url );

unless( $response->is_success ){
  resurrect();
}

HTH,
Thomas

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


  • LWP wls . admin
    • RE: LWP Thomas Bätzler
    • RE: LWP Thomas Bätzler

Reply via email to