[英]How do I configure WWW::Mechanize to work behind a proxy and https?
I've written Perl code using WWW::Mechanize to retrieve a webpage. 我已经使用WWW :: Mechanize编写了Perl代码来检索网页。 When I retrieve http webpages it works fine but it doesnt work for https.
当我检索http网页时,它工作正常,但不适用于https。 I've checked and I have the Crypt::SSLeay package.
我已经检查过,并且拥有Crypt :: SSLeay软件包。 What else could be wrong?
还有什么可能是错的?
The error message is.. 错误消息是..
Error GETing https://www.temp.com: Can't Connect to www.temp.com:443 <Bad hostname 'www.temp.com'> at scrape.pl line 8
I've seen in your related Mechanize question that you call the proxy
method with only the http
and ftp
schemes. 我在您相关的Mechanize问题中看到, 您仅使用
http
和ftp
方案调用proxy
方法 。 Try again with https
included. 包含
https
然后重试。
It's probably more useful to set up the proxy environment variables since then all programs can take advantage of this central configuration instead of configuring proxies for each program separately. 设置代理环境变量可能更有用,因为这样所有程序都可以利用此中央配置,而不必分别为每个程序配置代理。 Do not forget
https_proxy
. 不要忘记
https_proxy
。 Call the env_proxy
method instead of proxy
to use them. 调用
env_proxy
方法而不是proxy
来使用它们。
Apparently, I needed to add the following in my file 显然,我需要在文件中添加以下内容
$ENV{'HTTPS_PROXY'} = 'http://proxy:port/';
for Crypt::SSLeay 用于Crypt :: SSLeay
In case someone stumbles over this old question: The situation has changed in the recent years. 如果有人偶然发现了这个老问题:近年来情况发生了变化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.