in reply to Re^3: How to select NTLM authentication with LWP
in thread How to select NTLM authentication with LWP
The perl script is following:--Peforming request now...--------- --Done with request ...--------- Error: 401 Unauthorized Date: Tue, 11 Oct 2011 04:32:33 GMT Server: Microsoft-IIS/6.0 WWW-Authenticate: Negotiate WWW-Authenticate: NTLM Content-Length: 1251 Content-Type: text/html Client-Date: Tue, 11 Oct 2011 04:36:23 GMT Client-Peer: 10.1.1.1:80 Client-Response-Num: 7 Client-Warning: Credentials for 'domain\user' failed before Title: ��δ����Ȩ +5533;鿴��ҳ X-Powered-By: ASP.NET
#!/usr/bin/perl use LWP::UserAgent; use HTTP::Request::Common; use LWP::Debug qw(+); use Authen::NTLM; use strict; use warnings; ntlmv2(1); my $url = "http://10.1.1.1"; my $ua = new LWP::UserAgent(keep_alive => 1); $ua->credentials('10.1.1.1:80', '', 'domain\user', 'password'); my $req = HTTP::Request->new(GET => $url); print "--Peforming request now...---------\n"; my $res = $ua->request($req); print "--Done with request ...---------\n"; # check the outcome if ($res->is_success) { print $res->content; } else { print "Error: " . $res->status_line . "\n"; print $res->headers()->as_string(), "\n"; } exit 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How to select NTLM authentication with LWP
by Khen1950fx (Canon) on Oct 11, 2011 at 10:38 UTC | |
by tiedwu (Initiate) on Oct 12, 2011 at 08:18 UTC | |
by tiedwu (Initiate) on Oct 12, 2011 at 08:20 UTC | |
|
Re^5: How to select NTLM authentication with LWP
by riverron (Sexton) on Feb 07, 2012 at 02:55 UTC | |
by graemestewart (Initiate) on Nov 29, 2012 at 22:24 UTC |