http://513394217.blog.163.com/blog/static/10979118620125733237998/curl命令
-------------------
给某个网址POST数据:
Linux代码
- curl -d "id=1234"
在curl里添加代理IP:
Linux代码
- curl -x 219.136.206.29:80 -d "id=1234"
如果我们要投票的网站只是检测代理IP,那么,上述命令就能自动投票了。我们用PHP脚本,去某些代理网站抓取代理IP和端口,然后用exec调用拼凑好的命令。
Php代码
- /*------------获取proxy--------------*/
- $urlList = array(
- //'',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- '',
- ''
- );
-
- $result = array();
- foreach($urlList as $url) {
- echo "\nParsing web page: {$url}";
- $tmpHtml = file_get_contents($url);
- preg_match_all("/(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+(\d{1,4})\s+HTTP/i", $tmpHtml, $matches);
- for ($i=0; $i< count($matches[0]); $i++) {
- $result[] = $matches[1][$i] . ":" . $matches[2][$i];
- }
-
- }
- echo "\nParse excuted successfully!";
-
- /*------------逐个投票--------------*/
-
- echo "\n\n\nStart to vote:";
- $i = 1;
- $proxyList = $result;
- while(!empt y($proxyList)) {
- //empty多了个空格
- $proxy = array_shift($proxyList);
- echo "\n\nNo.{$i}\n";
- //暂停,控制投票频率
- $pauseSeconds = rand(10, 30);
- echo "pausing: {$pauseSeconds} s\n";
- sleep($pauseSeconds);
- //执行投票
- echo "vote from: {$proxy} \n";
- echo "----------------------\n";
- exec('curl -x ' . $proxy . ' -d "id=1234" ');
-
- $i++;
- }
-
- echo "\ndone!";
阅读(631) | 评论(0) | 转发(0) |