PHP Check Proxies

<?php
function checkProxies($proxies){
 
 $url = 'https://www.svnlabs.com/'; 
 
 $count = count($proxies); 
 
 echo 'Number of proxies in file: ' . $count . '<br />';

 $curl_arr = array();
 $master = curl_multi_init(); 

 for($i = 0; $i < $count; $i++) {
 $proxy = $proxies[$i]; 
 $curl_arr[$i] = curl_init(); 
 curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, TRUE); 
 curl_setopt($curl_arr[$i], CURLOPT_HEADER, FALSE); 
 curl_setopt($curl_arr[$i], CURLOPT_URL, $url); 
 curl_setopt($curl_arr[$i], CURLOPT_CONNECTTIMEOUT, 10); 

 $cproxy = explode(',', $proxy); 
 curl_setopt($curl_arr[$i], CURLOPT_PROXY, $cproxy[0]); 

 if($cproxy[1]) { 
 curl_setopt($curl_arr[$i], CURLOPT_PROXYUSERPWD, $cproxy[1]); 
 }
 curl_multi_add_handle($master, $curl_arr[$i]); 
 }

 $running = null;
 
 do {
 curl_multi_exec($master,$running); 
 } while($running > 0);

 
 for($i = 0; $i < $count; $i++) {
 
 echo $i . '. ' . $proxies[$i] .' > '. curl_error($curl_arr[$i]). '<br /><br />';
 
  
 }
 

 curl_multi_close($master); 


}


foreach (glob("full_list_new/*.txt") as $filename) {

$proxies = file($filename); 
$proxies = checkProxies($proxies);     
    
}

?>

Get Proxy List from http://hidemyass.com/proxy-list/

Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch