I recently had the same problem and solved it with code very similar to what I've pasted below.
Best of luck
------------------------------------------
#! c:\perl\bin\perl.exe
$| = 1;
use LWP::Simple;
use HTTP::Request;
use HTTP::Request::Common;
use HTTP::Response;
use LWP::UserAgent;
use Authen::NTLM;
use CGI::Carp qw(fatalsToBrowser);
use Net::HTTP;
use HTTP::Headers;
use Mail::Sendmail;
print "Content-type: text/html\n\n";
#_____________________________________________________________________
+__________
sub Giddyup ($){
my($content) = @_;
ntlm_reset();
ntlm_domain('');
ntlm_user(YOURUSERNAME);
ntlm_password(YOURPASSWD);
my $Type1MSG = ntlm('');
#__________First connection attempt_________
#make a user agent
my $ua = LWP::UserAgent->new(
keep_alive => 1,
timeout => 30,
);
#make a header header object
my $header1 = HTTP::Headers->new;
$header1->authorization('NTLM '. $Type1MSG);
$header1->content_type('application/x-www-form-urlencoded');
#Make a request and response object
my $req1 = HTTP::Request->new(POST => 'http://www.yoursite.whatev
+er', $header1, $content);
my $resp1 = $ua->request($req1);
my $code1 = $resp1 -> code;
my $Type2MSG = $resp1 -> www_authenticate;
$Type2MSG =~ s/NTLM //;
#__________Second connection attempt_________
my $Type3MSG = ntlm($Type2MSG);
#make a header header object
my $header2 = HTTP::Headers->new;
$header2->authorization('NTLM '. $Type3MSG);
$header2->content_type('application/x-www-form-urlencoded');
#Make a request and response object
my $req2 = HTTP::Request->new(POST => 'http://www.yoursite.whatev
+er', $header2, $content);
my $resp2 = $ua->request($req2);
$code2 = $resp2 -> code;
if ($code2 == 200){
print "<p>NTLM Connection established (Code:$code2)... req
+uest sent</p>";
}
}
#_____________________________________________________________________
+__________
#CODE STARTS HERE
print "<html><head><title>Enter Title Here</title></head><body>";
my $content = 'Field1=' . $Field1 . 'Field2=' . $Field2 . 'Field3=' .
+$Field3 . 'Field4=' . $Field4 . 'Field5=' . $Field5;
print "The content string contains:\n $content\n";
Giddyup($content);
|