#!/usr/bin/perl -w use strict; use LWP::UserAgent; use LWP::Protocol::https; use URI::URL; my %parm = ( url => 'https://XXX.XXX.XXX.XXX', uatimeout => 120, browser => 'IE/5.0', username => 'XXXXX', password => 'XXXXX', realm => 'XXXXX', ); my $netloc = new URI::URL($parm{'url'})->netloc(); my $ua = new LWP::UserAgent; $ua->agent($parm{'browser'}); $ua->timeout($parm{'timeout'}); $ua->credentials($netloc, $parm{'realm'}, $parm{'username'}, $parm{'password'}); my $request = new HTTP::Request POST=> $parm{'url'}; $request->authorization_basic($parm{'username'}, $parm{'password'}); my $page = $ua->request($request); #print $request->as_string(); if ($page->is_success) { print "Redirect\n"; print $page->content; } elsif ($page->is_redirect) { print $page->content; } else { print $page->error_as_HTML; print $page->content; } #### C:\TEMP>perl -w bcbs.pl Redirect 302 Found

Found

The document has moved here.

Additionally, a 302 Found error was encountered while trying to use an ErrorDocument to handle the request .