Connecting to Secure Site with UserName and Password prompt
cooper (cooper@llamacom.com)
Mon, 06 Sep 1999 15:18:23 -0700
I'm trying to connect to a secure site (https) that prompts for a
username
and password. I've been successfully using lwp to connect to non secure
sites without password/username prompts.
I've looked through the documentation and haven't been able to come up
with something that works (even on a secure, non-password prompting site
- such as
www.nodeworks.com).
I've installed the Crypt-SSLeay module.
the test script i'm using is below.
If someone could send me the basic code to hit an https site using
lwp::useragent, I'd greatly appreciate it.
Thanks!
Cooper
#!perl
use HTTP::Response;
use LWP::UserAgent;
use HTTP::Request;
#$url = "https://iso_si/isoCgi/msg.pl";
$url = "www.nodeworks.com";
#$un = "user";
#$pw = "pass";
my($ua) = new LWP::UserAgent;
my($app) = 'application/x-www-form-urlencoded';
my($req) = new HTTP::Request('POST',$URL);
$ua->timeout($timeout);
#$ua->credentials("CA ISO FOLSOM","SI.AUTHORIZED",$un,$pw);
$req->content_type($app);
$req->content($arg);
my($res) = $ua->request($req);
if ($res->is_success()) {
print $res->content();
} else { # error in response
print "error\n";
}