perl - WWW::Mechanize 错误:错误 GETing url 协议(protocol)方案 'https' 不受支持(LWP::Protocol::https 未安装)

标签 perl www-mechanize lwp lwp-useragent

我对 Perl 很陌生。我在工作中使用它,昨天我收到以下错误,因为前一天运行得很好的脚本。

Error GETing https://www.someurl.com:443: Protocol scheme 'https' is not supported (LWP::Protocol::https not installed)

(注意:www.someurl.com 不是真正的网址。我不想发布实际的网址,以防出现问题。)

我正在使用 WWW::Mechanize 来获取网页,但收到该行的错误

my $res = $mech->get( $url );

$url 的实际值甚至不是 https,而是 http://www.someurl.com

我提到了SO上的一些问题。喜欢这个Random error with WWW::Mechanize: Protocol scheme 'https' is not supported (LWP::Protocol::https not installed)其中提到要检查哪些模块并确认它们都已安装。还检查了Random error with WWW::Mechanize: Protocol scheme 'https' is not supported (LWP::Protocol::https not installed)但我认为它不适用于我,因为我没有将进程拆分为线程。

有人可以帮我吗?我很乐意发布所需的任何其他信息。

编辑:我使用的是 RHEL7 服务器,带有 Perl 5.16.3。 我安装了 WWW::Mechanize、openSSL、IO::Socket::SSL、LWP::Protocol:https、Net::SSLeay、Crypt::SSLeay。

在脚本上次运行和开始失败之间,我们没有更改任何配置或代码。

最佳答案

安装LWP::Protocol::https。它曾经被捆绑为 LWP 的一部分,但后来被转移到自己的发行版中,因此链接到 HTTPS 所需的库的复杂性不会给所有 LWP 带来负担。

% cpan LWP LWP::Protocol::https

关于perl - WWW::Mechanize 错误:错误 GETing url 协议(protocol)方案 'https' 不受支持(LWP::Protocol::https 未安装),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72470653/

相关文章:

perl - 在 Perl 中将字节转换为位序列(二进制)

perl - WWW::Mechanize 能否恢复之前的 SSL session ?

Perl REST::Client 通过cookie获取和使用CSRFToken和 session id的最佳方式

perl - 使用 LWP 和 Perl 登录网站

perl - Mechanize 基本问题

perl - cpanm 如何检索需要用户名和密码的代理设置

c++ - 痛饮 Perl : wrong ELF class

perl - autoflush 在 socket 中有什么作用?我们为什么用它?

database - 在 Perl 模块中部署数据库的好方法?

perl - 主机文件和 Perl 机械化