Не отображает.. просто выводит название файла скрипта... Вот код:
PHP код:
function socks_connect($host, $port, $dh, $dp)
{
$result=true;
$f = fsockopen($host, $port, $errno, $errstr, 10) or $result=false;
if($result)
{
$h = gethostbyname($dh);
preg_match("#(\d+)\.(\d+)\.(\d+)\.(\d+)#", $h, $m);
fwrite($f, "\x05\x01\x00");
$r = fread($f, 2);
if(!(ord($r[0])==5 and ord($r[1])==0)) $result=false;
if($result)
{
fwrite($f, "\x05\x01\x00\x01" . chr($m[1]).chr($m[2]).chr($m[3]).chr($m[4]).chr($dp/256).chr($dp%256));
$r = fread($f, 10);
if(!(ord($r[0])==5 and ord($r[1])==0))
return false;
else
return $f;
}
}
}
$fpion = fopen('proxy.txt', 'rt');
if ($fpion) {
while (!feof($fpion)) {
$taken = fgets($fpion,4096);
list ($proxyhost, $proxyport) = split(':',$taken);
@set_time_limit(0);
$fp = socks_connect("$proxyhost","$proxyport",'site.com',80);
if (!$fp) {
//echo $proxyhost.':'.$proxyport.' ---> FALSE '.$status."<br>";
} else {
$query = "GET /captcha.php HTTP/1.1\r\n";
$query .= "Host: site.com\r\n";
$query .= "Connection: Close\r\n";
$query .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6\r\n";
$query .= "Accept: image/png,image/*;q=0.8,*/*;q=0.5\r\n";
$query .= "Accept-Language: ru,en-us;q=0.7,en;q=0.3\r\n";
$query .= "Accept-Encoding: gzip,deflate\r\n";
$query .= "Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7\r\n";
$query .= "Keep-Alive: 115\r\n";
$query .= "Connection: keep-alive";
$query .= "Referer: http://site.com/contest/id-260/\r\n";
$query .= "Cache-Control: max-age=0\r\n\r\n";
fwrite($fp, $query);
$page = '';
while (!feof($fp)) {
$page .= fgets($fp, 4096);
//echo $proxyhost.':'.$proxyport.' ---> OK '."<br>";
}
}
}
}
$in = $page; // в этой переменной хранится текст изображение из первого поста
list(, $val) = explode("\r\n\r\n", $in, 2);
header('Content-Type: image/jpeg');
echo $val;
|