如何向该脚本添加代理支持?
use LWP::Simple;
$url = "http://stackoverflow.com";
$word = "how to ask";
$content = get $url;
if($content =~ m/$word/)
{
print "Found $word";
}
访问底层 LWP::UserAgent 对象并设置代理。 LWP::Simple 导出$ua
变量,所以你可以这样做:
use LWP::Simple qw( $ua get );
$ua->proxy( 'http', 'http://myproxy.example.com' );
my $content = get( 'http://www.example.com/' );
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)