<?php
function get_page($site,$page,$isheaders=false,$ua='Opera 9.27 (compatible; MSIE 6.0; Windows NT 5.1; ru)',$ref='',$cookie='',$post='')
{
$socket = fsockopen($site, 80, $errno, $errstr, 15); if ($socket){
if ($post!=''){
$send = "POST $page HTTP/1.0
";
$send .= "Content-Length: ". strlen($post) ." ";
$send .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8
";
} else $send = "GET $page HTTP/1.0
";
$send .= "User-Agent: $ua
";
$send .= "Host: $site
";
$send .= "Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
";
if($ref!='') $send .= "Referer: $ref
";
if($cookie!=''){
$send .= "Cookie: $cookie
";
$send .= 'Cookie2: $Version=1'."
";
}
$send .= "Accept-Language: ru,en;q=0.9,ru-RU;q=0.8
";
$send .= "Connection: close
".$post;
if(fputs($socket,$send)) { if(!$isheaders) while(fgets($socket,1024)!=" $he="";
while(!feof($socket)) $he.=fread($socket,10240); };
}
return $he;
};
?>