d3g1d5

Curl With Auto Proxy Grabber

May 26th, 2020
1,401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.62 KB | None | 0 0
  1. <?php
  2. function GrabProxy() {
  3.     $curl = curl_init();
  4.     $data = array(
  5.         CURLOPT_URL => "https://www.sslproxies.org", CURLOPT_REFERER => "https://google.com/",
  6.         CURLOPT_SSL_VERIFYPEER => false, CURLOPT_RETURNTRANSFER => FALSE,
  7.         CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
  8.         CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_FOLLOWLOCATION => TRUE
  9.     );
  10.     curl_setopt_array($curl,$data);
  11.     $response = curl_exec($curl);
  12.     curl_close($curl);
  13.     preg_match_all('@<td>(.*?)</td>@si',$response,$return);
  14.     for($i=0; $i < 400; $i+=4) {$proxy[] = $return[1][$i];}
  15.     for ($i=1; $i < 400; $i+=4) {$port[] = $return[1][$i];}
  16.     $merge = array_merge($proxy,$port);
  17.     for ($i=100; $i < 200; $i++) {$proxz[] =  $i;}
  18.     for ($i=0; $i < 99 ; $i++){$random[] = $merge[$i].":".$merge[$proxz[$i]];}
  19.     return $random[rand(0,98)];
  20. }
  21. function Test() {
  22.     $proxy = explode(':', GrabProxy());
  23.     $curl = curl_init();
  24.     $data = array(
  25.         CURLOPT_URL => "https://www.myip.com/", CURLOPT_REFERER => "https://google.com/",
  26.         CURLOPT_SSL_VERIFYPEER => false, CURLOPT_RETURNTRANSFER => FALSE,
  27.         CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36",
  28.         CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_PROXY => $proxy[0], CURLOPT_PROXYPORT => $proxy[1]
  29.     );
  30.     curl_setopt_array($curl,$data);
  31.     $response = curl_exec($curl);
  32.     curl_close($curl);
  33.     return print($response);
  34. }
  35. Test();
Add Comment
Please, Sign In to add comment