<?php set_time_limit(0); $fp = fsockopen("proxy.shternov.ru", 80, $errno, $errstr, 30); if ($fp) { $out = "GET / HTTP/1.1\r\n"; $out .= "Host: proxy.shternov.ru\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); $fgets = ''; $content = ''; while(!feof($fp)) { $content .= fread($fp,8192); } fclose($fp); preg_match_all ("#(bgcolor=\#FFFFFF><td>)(.*?)(<\/td><td>)(.*?)(<\/td><td title=)#si", $content, $matche1); $count_proxy = count($matche1[2]); for ($i = 0; $i <= $count_proxy; $i++) { $fp = fsockopen($matche1[2][$i], $matche1[4][$i], $errno, $errstr, 30); if ($fp) { $out = "GET http://www.ya.ru/ HTTP/1.1\r\n"; $out .= "Host: ya.ru\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); $fgets = ''; $content = ''; while(!feof($fp)) { $content .= fread($fp,8192); } fclose($fp); preg_match_all ("#(<title>)(.*?)(<\/title>)#si", $content, $matche1); if($matche1['2']['0'] == 'Яndex') { // echo "$matche1[2][$i]:$matche1[4][$i]<br>".flush(); $file = fopen ("proxy/proxy.txt","a+"); $str = "$matche1[2][$i]:$matche1[4][$i]\n"; if ( $file ) { fputs ( $file, $str); } fclose ($file); } } } } ?>