zymtom

MCbouncer scraper WITH PROXY SUPPORT

Jul 2nd, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.31 KB | None | 0 0
  1. <?php
  2. $proxyarray = array();
  3. $proxyinuse = 0;
  4. $proxy = $proxyarray[$proxyinuse];
  5. //$proxyauth = 'user:password';
  6.  
  7. $ch = curl_init();
  8. curl_setopt($ch, CURLOPT_URL,$url);
  9. curl_setopt($ch, CURLOPT_PROXY, $proxy);
  10. //curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
  11. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  12. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  13. curl_setopt($ch, CURLOPT_HEADER, 1);
  14.  
  15. $fp = fopen("scraped.txt", "a");
  16. $url = 'http://mcbouncer.com/userbans';
  17. $numberofpages = curl_exec($ch);
  18.  
  19. $regex = '/<a.*href="\?page=(.*)".*>Last<\/a>/';
  20. preg_match($regex,$numberofpages,$pagearray);
  21. print_r($pagearray);
  22. $page = $pagearray[1];
  23. $array = array();
  24. $reqs = 1;
  25. for($i = 1; $i <= $page; $i++){
  26.     if($reqs == 5){
  27.         $reqs = 0;
  28.         $proxyinuse++;
  29.         $proxy = $proxyarray[$proxyinuse];
  30.     }
  31.     $url = http://mcbouncer.com/userbans?page='.$i;
  32.     $data = curl_exec($ch);
  33.     $data = str_replace("<a", "\n<a", $data);
  34.     $data = str_replace("</a>", "</a>\n", $data);
  35.     $regex = '/<a.*href="\/user\/.*>(.*)<\/a>/';
  36.     preg_match_all($regex,$data,$output);
  37.     foreach($output[1] as $key => $val){
  38.         if(!in_array($val, $array)){
  39.             echo $val."\n\r";
  40.             $array[] = $val;
  41.             fwrite($fp, $val."\n");
  42.         }
  43.     }
  44. }
  45. curl_close($ch);
  46. fclose($fp);
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment