如何配置 WWW::Mechanize 以在代理和 https 后面工作? [英] How do I configure WWW::Mechanize to work behind a proxy and https?

查看:56
本文介绍了如何配置 WWW::Mechanize 以在代理和 https 后面工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 WWW::Mechanize 编写了 Perl 代码来检索网页.当我检索 http 网页时,它工作正常,但不适用于 https.我已经检查过了,我有 Crypt::SSLeay 包.还有什么问题?

I've written Perl code using WWW::Mechanize to retrieve a webpage. When I retrieve http webpages it works fine but it doesnt work for https. I've checked and I have the Crypt::SSLeay package. What else could be wrong?

错误信息是..

Error GETing https://www.temp.com: Can't Connect to www.temp.com:443 <Bad hostname 'www.temp.com'> at scrape.pl line 8

推荐答案

我在 你的相关机械化您调用 proxy 方法的问题仅使用 httpftp 方案.使用 https 重试.

I've seen in your related Mechanize question that you call the proxy method with only the http and ftp schemes. Try again with https included.

设置代理环境变量可能更有用从那时起,所有程序都可以利用这种中央配置,而不是分别为每个程序配置代理.不要忘记 https_proxy.调用 env_proxy 方法 而不是 代理使用它们.

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. Call the env_proxy method instead of proxy to use them.

这篇关于如何配置 WWW::Mechanize 以在代理和 https 后面工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆