In article <hNOmc.29402$U75.15715edtnps89>,
[email][/email] <> wrote:
>I am trying to write a script that is authenticated over https, get a cookie
>and accept the redirect 302 from the server to another page.
>Can't locate object method "url" via package "URI::https" at
>C:/Perl/site/lib/HTTP/ line 43. Even if I am using Active Perl
>(revision 5 version 8 subversion 3) on Linux version I get similar errors on
>107 line in module.
>use strict;
>#use warnings;
>use LWP::UserAgent;
>use HTTP::Cookies;
>use HTTP::Headers;
>my $code; my $msg;my $header; my $content;
>my $ua = LWP::UserAgent->new;
>my $cookie_jar = HTTP::Cookies->new(
>file => "$ENV{HOMEPATH}/lwp_cookies.dat",
>autosave => 1,
>my $req = HTTP::Request->new(POST => 'https://cntcaftqa/main/default.asp');
>$req->content('userid=myuser&password=mypassword&action =Log+On&url=https://c
>my $res = $ua->request($req);
>if ($res->status_line=='302 Object moved'){
> my $req1 = $res->base;
> $cookie_jar->add_cookie_header($req1);
> $req->content($req1);
> my $res = $ua->request($req);
> print $res->code;
I'm not sure what the problem is but you may want to
add debug, and a few print's may help:

use LWP::Debug qw(+);

print $req->as_string;
print $cookie_jar->as_string;

Also, I'd rewrite this line:
if ($res->status_line=='302 Object moved'){
if ($res->code == 302){

(review perlop for eq/== diff's)

Charles DeRykus