我正在尝试使用 Perl 的 Mechanize 库填写 Web 表单。
每当我在搜索框中输入 URL 时,它都会提示以下消息,我可以手动成功登录。
但是,当我运行以下脚本时,出现以下错误:
如何使用我的$mech
对象正确填写第一个身份验证框凭据?
my $mech = WWW::Mechanize->new( 'keepalive' => 1 );
my $url = "http://URL/I/NEED/TO/ACCESS";
my $username = "username";
my $password = "password";
$mech->credentials($username, $password);
$mech->get($url); <----------------- ERROR (LINE 93)
编辑:
这是在wget
请求的站点上运行的结果
--2013-08-30 11:16:17-- http://moss.micron.com/MFG/ProbeTest/Lists/Manufacturing%20Requests/AllItems.aspx
Resolving moss.micron.com... 137.201.88.118
Connecting to moss.micron.com|137.201.88.118|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 401 Unauthorized
Server: Microsoft-IIS/7.0
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 12.0.0.6341
Date: Fri, 30 Aug 2013 17:16:17 GMT
Connection: keep-alive
Content-Length: 0
Authorization failed.