Home > Backend Development > PHP Tutorial > PHP voting applet, anti-timeout, anti-IP restriction

PHP voting applet, anti-timeout, anti-IP restriction

WBOY
Release: 2016-07-23 08:54:56
Original
5172 people have browsed it
  1. //Welcome to back.zhizhi123.com
  2. //Reference blog post http://back.zhizhi123.com/?p=126
  3. set_time_limit(0);//Prevent timeout
  4. function toupiao($i)
  5. {
  6. $proxy = array('182.48.116.51:8080','110.177.63.191:9999','221.10.40.238:80','221.10.40.236:83','221.10. 40.237:80','221.10.102.199:82','42.121.0.247:9999','42.121.28.111:3128','117.135.194.139:80','119.147.91.21:80','58.247.1 09.243: 80','118.233.36.246:8585');
  7. $url = "http://www.example.com/tea/love.php";
  8. $ch = curl_init();
  9. $data = array (
  10. 'id' => '13'
  11. );
  12. //Set the source address. If not set, the forum server may be verified and not allowed to reply
  13. curl_setopt($ch,CURLOPT_REFERER,"http://www .example.com/tea/index.php?m=content&c=index&a=lists&catid=10");
  14. //Can save cookies
  15. curl_setopt($ch,CURLOPT_COOKIESESSION,true);
  16. curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)");
  17. curl_setopt($ch, CURLOPT_PROXY, $ proxy[$i]);
  18. curl_setopt($ch, CURLOPT_POST, 1);
  19. curl_setopt($ch, CURLOPT_HEADER, 0);
  20. curl_setopt($ch, CURLOPT_URL,$url);
  21. //For support cookie
  22. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  23. $result = curl_exec($ch);
  24. if(curl_errno($ch))
  25. {
  26. echo 'Curl error: ' . curl_error($ ch);
  27. }
  28. }
  29. for($i=0;$i<=11;$i++)
  30. {
  31. echo "begin the ".$i."th vote";
  32. toupiao( $i);
  33. echo 'end';
  34. echo "
    ";
  35. }
Copy code

PHP


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template