Хакерский форум

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Хакерский форум » PHP » [PHP] Сбор прокси


[PHP] Сбор прокси

Сообщений 1 страница 2 из 2

1

Код:
<?php 
set_time_limit(0); 
//-----------------// 
$proxy_txt = "proxy.txt"; 
//-----------------// 
function curl($url) 
{ 
$ch = curl_init($url); 
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.0.4) Gecko/2008102920 AdCentriaIM/1.7 Firefox/3.0.4"); 
curl_setopt($ch, CURLOPT_HEADER, 1); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
return $res_index  = curl_exec($ch); 
} 
$proxy_file = "proxy_temp.txt"; 

/* samair.ru */ 
$page = curl('http://www.samair.ru/proxy/proxy-01.htm'); 
preg_match_all('#<a href="proxy-(.*?).htm">#', $page, $page_match); 

for ($i = 0; $i < count($page_match[0])-1; $i++) 
{ 
$curl = curl('http://www.samair.ru/proxy/proxy-'.$page_match[1][$i].'.htm'); 

$fh = fopen($proxy_file, "a+"); 
for ($p = 0; $p < 15; $p++) 
{ 
preg_match_all('#<tr><td>(.*?)</td><td>#', $curl, $proxy); 
$success - fwrite($fh, $proxy[1][$p]."\r\n"); 
} 
fclose($fh); 
} 

/* proxy4free.com */ 
for ($p = 1; $p <= 2; $p++) 
{ 
$list1 = curl('http://www.proxy4free.com/page'.$p.'.html'); 
$list1 = explode('<tr bgcolor="#ffffff" class="text" height=10>',$list1); 

$fh = fopen($proxy_file, "a+"); 
for ($i = 1; $i <= 90; $i++) 
{ 

if(preg_match_all('#<td>(.*?)</td>#', $list1[$i], $proxy)){ 

$success - fwrite($fh, $proxy[1][0].':'.$proxy[1][1]."\r\n"); 
} 
} 
fclose($fh); 
} 


/* hideme.ru */ 
$list1 = curl('http://hideme.ru/proxy-list/proxy-list-1-1');   // Лист с прокси 1... 
$list2 = curl('http://hideme.ru/proxy-list/proxy-list-2-1');  // ...2 
$fast1 = curl('http://hideme.ru/proxy-list/fast-proxy-1');   // Лист с быстрыми прокси 1... 
$fast2 = curl('http://hideme.ru/proxy-list/fast-proxy-2');  // ...2 

preg_match('#</div><br>'."\r\n".'(.*?)<br></div>#', $list1, $list1); 
preg_match('#</div><br>'."\r\n".'(.*?)<br></div>#', $list2, $list2); 
preg_match('#</div><br>'."\r\n".'(.*?)<br></div>#', $fast1, $fast1); 
preg_match('#</div><br>'."\r\n".'(.*?)<br></div>#', $fast2, $fast2); 

$fh = fopen($proxy_file, "a+"); 
$success - fwrite($fh, str_replace('<br>',"\r\n",$list1[1])."\r\n".str_replace('<br>',"\r\n",$list2[1])."\r\n".str_replace('<br>',"\r\n",$fast1[1])."\r\n".str_replace('<br>',"\r\n",$fast2[1])."\r\n"); 
fclose($fh); 

/* Удаляем одинаковые прокси */ 
$_file=file($proxy_file);   
$_file=array_values(array_unique($_file));   
  
$fp=fopen($proxy_file,"w+");   
for($i=0;$i<count($_file);$i++)   
{   
flush();   
fputs($fp,$_file[$i]);   
}   
fclose($fp); 

file_put_contents($proxy_txt,file_get_contents($proxy_file)); 
unlink($proxy_file) 
 /* geforse.name */ 
?>

0

2

спасибо,сейчас затестим

0


Вы здесь » Хакерский форум » PHP » [PHP] Сбор прокси