如何为此脚本添加代理支持?
use LWP::Simple;
$url = "http://stackoverflow.com";
$word = "how to ask";
$content = get $url;
if($content =~ m/$word/)
{
print "Found $word";
}
Run Code Online (Sandbox Code Playgroud)
bri*_*foy 13
访问基础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/' );
| 归档时间: |
|
| 查看次数: |
4823 次 |
| 最近记录: |