perl 通过代理 访问

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               
获取代理地址:49.94.146.182:3128[root@dr-mysql01 test]# cat get.pl use  LWP::UserAgent; my $ua = LWP::UserAgent->new;$ua->timeout(10);$ua->env_proxy;$ua->agent("Mozilla/8.0");my $response = $ua->get('http://www.kuaidaili.com/api/getproxy?orderid=963771205365827&num=9999');if ($response->is_success) { print $response->decoded_content;  # or whatever}else { die $response->status_line;}[root@dr-mysql01 test]# perl get.pl | more117.177.243.111:8080218.92.227.168:34034223.85.83.47:8123117.177.243.38:83207.5.112.114:8080111.12.117.68:8082117.177.243.56:86117.177.243.39:8081204.27.58.202:811代理服务器使用:3.代理属性$ua->proxy(\@schemes, $proxy_url) $ua->proxy($scheme, $proxy_url) 如  $ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/'); $ua->proxy('gopher', 'http://proxy.sn.no:8001/');指明通过制定的代理服务器,按照指定的协议方法访问。jrhmpt01:/root/test# cat get.pl use  LWP::UserAgent;my $ua = LWP::UserAgent->new;$ua->timeout(10);#$ENV{HTTPS_PROXY} = "http://$ARGV[0]";$ua->agent("Mozilla/8.0");$ua->proxy('http',"http://$ARGV[0]");print $ua->proxy('http',"http://$ARGV[0]")."\n";my $response = $ua->get('http://wenjinbao.winfae.com');if ($response->is_success) { print $response->decoded_content;  # or whatever}else { die $response->status_line; }Jul 24 13:24:49 localhost haproxy[11504]: 218.92.227.165:40427 [24/Jul/2015:13:24:49.633] www~ webserver_8001/webhost02_8001 146/0/1/1/148 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:08 localhost haproxy[11452]: 115.236.160.82:46444 [24/Jul/2015:13:25:08.582] www webserver_8001/webhost01_8001 81/0/1/1/83 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:08 localhost haproxy[11452]: 115.236.160.82:46445 [24/Jul/2015:13:25:08.888] www webserver_8001/webhost02_8001 75/0/1/1/77 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:09 localhost haproxy[11452]: 115.236.160.82:46446 [24/Jul/2015:13:25:09.154] www webserver_8001/webhost01_8001 43/0/0/1/44 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:09 localhost haproxy[11452]: 115.236.160.82:46447 [24/Jul/2015:13:25:09.392] www webserver_8001/webhost02_8001 72/0/0/1/73 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:09 localhost haproxy[11452]: 115.236.160.82:46448 [24/Jul/2015:13:25:09.728] www webserver_8001/webhost01_8001 41/0/1/1/43 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:10 localhost haproxy[11452]: 115.236.160.82:46449 [24/Jul/2015:13:25:09.978] www webserver_8001/webhost02_8001 58/0/0/1/59 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:10 localhost haproxy[11504]: 115.236.160.82:46450 [24/Jul/2015:13:25:10.230] www www/<NOSRV> 46/-1/-1/-1/46 302 126 - - LR-- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:11 localhost haproxy[11504]: 115.236.160.82:46453 [24/Jul/2015:13:25:11.180] www www/<NOSRV> 70/-1/-1/-1/70 302 126 - - LR-- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:11 localhost haproxy[11452]: 115.236.160.82:46455 [24/Jul/2015:13:25:11.607] www webserver_8001/webhost01_8001 46/0/1/0/47 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:11 localhost haproxy[11504]: 115.236.160.82:46456 [24/Jul/2015:13:25:11.888] www www/<NOSRV> 75/-1/-1/-1/75 302 126 - - LR-- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:12 localhost haproxy[11504]: 218.92.227.165:41490 [24/Jul/2015:13:25:12.047] www~ webserver_8001/webhost01_8001 86/0/1/0/88 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:12 localhost haproxy[11504]: 115.236.160.82:46458 [24/Jul/2015:13:25:12.367] www www/<NOSRV> 40/-1/-1/-1/40 302 126 - - LR-- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:12 localhost haproxy[11452]: 115.236.160.82:46460 [24/Jul/2015:13:25:12.765] www webserver_8001/webhost02_8001 57/0/1/1/59 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:13 localhost haproxy[11452]: 115.236.160.82:46461 [24/Jul/2015:13:25:13.050] www webserver_8001/webhost01_8001 62/0/0/1/63 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:13 localhost haproxy[11452]: 115.236.160.82:46462 [24/Jul/2015:13:25:13.292] www webserver_8001/webhost02_8001 78/0/1/2/81 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:13 localhost haproxy[11452]: 115.236.160.82:46463 [24/Jul/2015:13:25:13.593] www webserver_8001/webhost01_8001 77/0/1/1/79 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:13 localhost haproxy[11504]: 115.236.160.82:46464 [24/Jul/2015:13:25:13.893] www www/<NOSRV> 41/-1/-1/-1/41 302 126 - - LR-- 0/0/0/0/0 0/0 "GET / HTTP/1.1"Jul 24 13:25:17 localhost haproxy[11504]: 219.217.227.93:58576 [24/Jul/2015:13:25:15.385] www~ webserver_8001/webhost02_8001 2440/0/1/0/2442 200 14233 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow
这里写图片描述
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值