churchofsatan, попробуй это.
PHP код:
<?
################################################################################################################
# #
# ********************************************************************************************************************************************************#
# * Название : php-proxy checker #
# * Чо за на? : Скрипт, который проверяет прокси-сервер на валидность, определяя его скорость #
# * Автор : pixcher (runthes.ru) #
# * Версия : 1.00 #
# ********************************************************************************************************************************************************#
# #
################################################################################################################
$site = "www.pixcher.4kv.ru";
echo "
<body><div align=\"center\"><form action=\"$PHP_SELF\" method=\"POST\"><table width=\"500\" border=\"1\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#9ab4d4\" bgcolor=\"#9ab4d4\"><tr>
<td height=\"23\" bgcolor=\"#9ab4d4\" ><div align=\"center\"><b>
.: Прокси чекер :.
</b></div></td></tr><tr><td height=\"84\" bgcolor=\"#FFFFFF\"><div align=\"center\">
Прокси лист:<br>
<i>Формат host:port<br>
Например:127.0.0.1:8080</i>
<br><textarea name=\"xproxies\" cols=40 rows=20></textarea></div></td></tr><tr><td height=\"28\" bgcolor=\"#FFFFFF\"><div align=\"center\">
<input name=\"go\" type=\"submit\" value=\"Отправить\">
</div></td></tr></table></form></div></body>";
if (isset($go)){
ignore_user_abort(1);
set_time_limit(0);
$xproxies=str_replace("\r","",$xproxies);
$xproxies=str_replace(";","\n",$xproxies);
$xproxies=str_replace(",","\n",$xproxies);
$xproxies=str_replace(" ",":",$xproxies);
$xproxies=explode("\n",$xproxies);
echo "<div align=\"center\"><table width=\"500\" border=\"1\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#9ab4d4\" bgcolor=\"#9ab4d4\"><tr><td><center><b>Прокси сервер</b></center></td><td><center><b>Скорость (чем меньше, тем круче)</b></center></td></tr>";
foreach($xproxies as $key => $value){
$value = explode(':',$value);
if (!empty($value[0]) and !empty($value[1])){
$time=microtime();
$time=explode(' ',$time);
$time_start=$time[1]+$time[0];
if($stream=@fsockopen($value[0],$value[1],$errno,$error,1)){
fwrite($stream,"GET http://$site/ HTTP/1.0\n\r\n\rHost: $site\n\r\n\r");
stream_set_timeout($stream, 1);
while(!feof($stream))
fgets($stream,1024);
fclose($stream);
$time=microtime();
$time=explode(' ',$time);
$time_stop=$time[1]+$time[0];
$timetoanswer=$time_stop-$time_start;
$timetoanswer=substr($timetoanswer,0,5);
echo "<tr bgcolor=\"#FFFFFF\"><td><center>$value[0]:$value[1]</center></td><td><center>$timetoanswer мсек.</center></td></tr>";}}}
echo "</div></table>";}
?>