无法使用perl访问WWW :: mechanize的https页面

时间:2013-03-09 07:48:37

标签: perl https www-mechanize

我正在尝试使用perl中的WWW :: Mechanize库访问https页面。这就是我所拥有的:

#!/usr/local/bin/perl -w
use strict;
use lib '/home/perl_modules/libwww-perl-5.836/lib';
use lib '/home/perl_modules/WWW-Mechanize-1.72/lib';
use lib '/home/perl_modules/HTML-Tree-5.03/lib';
use lib '/home/perl_modules/Crypt-SSLeay-0.64/lib';
use WWW::Mechanize;

my $m = WWW::Mechanize->new();


my $url = "http://alumni.nd.edu";
my $alias = "Linux Mozilla";

$m->agent_alias($alias);

$m->follow_link(url => "/s/1210/start.aspx?sid=1210&gid=1&pgid=3&cid=40");

这是输出:

Error GETing https://securelb.imodules.com/?sid=1210&gid=1&pgid=3&cid=40&returnurl=http%3a%2f%2falumni.nd.edu%2f: Server closed connection without sending any data back at www_mech_test.pl line 17

在阅读了一些关于WWW :: Mechanize的帮助页面之后,我尝试设置别名并包括Crypt-SSLeay模块,但我仍然遇到上述错误。我错过了什么?这是在RHEL 5.5下运行。

1 个答案:

答案 0 :(得分:0)

您的代码未加载页面$ url ='http://alumni.nd.edu“'

在follow_link之前添加:

$m->get($url);
$m->follow_link(url => "/s/1210/start.aspx?sid=1210&gid=1&pgid=3&cid=40");

follow_link调用搜索由WWW :: Mechanize加载的文档,没有它,它不会找到任何东西。