Bonjour 
Voici un gros bout de code que j'ai moi même réalisé,
C'est un Proxy checker, le code ne contient aucuns bug, je l'ai testé plusieurs fois
Cordialement,
Reibun
Voici un gros bout de code que j'ai moi même réalisé,
C'est un Proxy checker, le code ne contient aucuns bug, je l'ai testé plusieurs fois
Code:
<?php
set_time_limit(0);
/***********************************************
* Proxy Checker
* Coded by Reibun
------------------------------------------------
* La liste d'IP doit avoir comme apparence IP:PORT ***********************************************/
/*-----------------------------------------------------------------------*/
echo "\n[+]Choisissez la liste de proxy: ";
$proxy_list = fgets(STDIN);
$proxy_list = str_replace("\r\n","",$proxy_list);
$proxy_list = trim($proxy_list);
echo "[+]Entrez le nombre de sujets: ";
$thread = fgets(STDIN);
$thread = str_replace("\r\n","",$thread);
$thread = trim($thread);
echo "[+]Entrez le temps désiré: ";
$timeout = fgets(STDIN);
$timeout = str_replace("\r\n","",$timeout);
$timeout = trim($timeout);
echo "[+]Vérification des proxy\n";
echo "-------------------------------------------------------\n";
$open_file = file($proxy_list);
$open_file = preg_replace("#\r\n#si","",$open_file);
checker($open_file,$thread);
/*-----------------------------------------------------------------------*/
function checker($ips,$thread)
{
global $timeout;
$multi = curl_multi_init();
$ips = array_chunk($ips,$thread);
$total = 0;
$time1 = time();
foreach($ips as $ip)
{
for($i=0;$i<=count($ip)-1;$i++)
{
$curl[$i] = curl_init();
curl_setopt($curl[$i],CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl[$i],CURLOPT_URL,$ip[$i]);
curl_setopt($curl[$i],CURLOPT_TIMEOUT,$timeout);
curl_multi_add_handle($multi,$curl[$i]);
}
do
{
curl_multi_exec($multi,$active);
usleep(11);
}while( $active > 0 );
foreach($curl as $cid => $cend)
{
$info = curl_getinfo($cend);
curl_multi_remove_handle($multi,$cend);
if($info['http_code'] != 0)
{
$total++;
echo "[~]Proxy works -> ".$ip[$cid]."\n";
save_file("works.txt",$ip[$cid]);
}
}
}
$time2 = time();
echo "\n[+]Total des proxy fonctionnel: $total,checking completed\n";
echo "[+]Temps écoulé -> ".($time2-$time1)." seconds\n";
echo "[+]Code réalisé par Reibun pour RealityGaming\n";
echo "-------------------------------------------------------\n";
}
function save_file($file,$content)
{
$open = fopen($file,'ab');
fwrite($open,$content."\r\n");
fclose($open);
}
?>
Cordialement,
Reibun