perl 通过代理 访问
2015-07-24 15:11
363 查看
获取代理地址: 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 | more 117.177.243.111:8080 218.92.227.168:34034 223.85.83.47:8123 117.177.243.38:83 207.5.112.114:8080 111.12.117.68:8082 117.177.243.56:86 117.177.243.39:8081 204.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"
相关文章推荐
- omx 使用总结
- Lowest Common Ancestor of a Binary Search Tree
- 怎么解决eclipse报PermGen space异常的问题
- Serv-U 15 架设FTP文件服务器 图文教程
- 图像处理------基于Otsu阈值二值化
- Storm UI各个指标详解
- 初窥Linux 之 我最常用的20条命令
- jquery中attr和prop的区别
- 【转】在Android布局中使用include和merge标签
- 图像处理------基于Otsu阈值二值化 分类: 视频图像处理 2015-07-24 15:11 80人阅读 评论(0) 收藏
- 开源网站网罗
- 【YII2学习笔记】20150724-1
- Razor简单的例子
- 对HtmlHelper扩展二:添加RadioButtonList、CheckBoxList
- poj 1655 Balancing Act 【树的重心】
- 您没有必要的权限更改此用户的域登录名
- 图像处理------Canny边缘检测
- Jedis “Socket读取超时”导致“返回值类型错误”
- hdu 3511 Prison Break 圆 扫描线
- Js笛卡尔乘积