Показать сообщение отдельно

  #873  
Старый 03.09.2009, 19:35
geforse
Постоянный
Регистрация: 02.03.2008
Сообщений: 893
Провел на форуме:
5365841

Репутация: 712


Smile

Может кому пригодиться, скрипт собирает прокси и сохраняет в файл...ставьте на cron и можете размещать список с прокси у себя на сайте

PHP код:
<?php
set_time_limit
(0);
//-----------------//
$proxy_txt "proxy.txt";
//-----------------//
function curl($url)
{
$ch curl_init($url);
curl_setopt($chCURLOPT_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($chCURLOPT_HEADER1);
curl_setopt($chCURLOPT_RETURNTRANSFER1);
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($fhstr_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 */
?>
 
Ответить с цитированием