$host=0; $hosts = array("a", "b", "c"); $ss = $hosts[$host]; $uid =str_replace("http://","",$uid); $uid =str_replace("www.","",$uid); $uid =str_replace("a.test.ru/","",$uid); $uid =str_replace("b.test.ru/","",$uid); $uid =str_replace("c.test.ru/","",$uid); $uid =str_replace(" ","+",$uid); $fp = fsockopen("$ss.test.ru", 80, $errno, $errstr, 30); if (!$fp) { return $host+1; } else { $out ="GET /$filename HTTP/1.1\r\n"; $out.="Accept: */*\r\n"; $out.="Host: $ss.test.ru\r\n"; $out.="Accept-Language: ru\r\n"; $out.="User-Agent: Mozilla/5.0 (compatible; NavyBS 7.01; OS X)\r\n"; $out.="Proxy-Connection: Keep-Alive\r\n"; $out.="Connection: close\r\n\r\n"; fwrite($fp, $out); $tmp = ""; for ($i=0; $i<3; $i++) $tmp .= fgets($fp, 128); $file = file_get_contents("http://$ss.test.ru/".$tmp); }