简体   繁体   English

如何在Perl的WWW :: Mechanize中使用Web代理?

[英]How to do I use a web proxy with Perl's WWW::Mechanize?

I'm trying to use WWW::Mechanize with a proxy server, but seems like I cant get it to work. 我正在尝试与代理服务器一起使用WWW :: Mechanize,但似乎无法使它正常工作。 Since Mechanize is a subclass of LWP::UserAgent, I've been reading about the proxy thing over link text 由于Mechanize是LWP :: UserAgent的子类,因此我一直在阅读有关链接文本的代理内容

I have a list of proxies, for example: 我有一个代理列表,例如:

74.87.151.157:8000  
69.171.152.25:3128  
190.253.82.253:8080 
189.11.196.221:3128 
41.234.205.201:8080

I have no idea how to use them. 我不知道如何使用它们。

Thanks, 谢谢,

This example sets a HTTP-proxy: 这个例子设置了一个HTTP代理:

my $mech  = WWW::Mechanize->new();
my $proxy = '74.87.151.157:8000';

$mech->proxy('http', "http://$proxy");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM