| |
|
|
| |
для: golovdinov
(06.02.2007 в 21:06)
|
| |
вот пример конекта к онлайн игре
<?
function poster ($host, $url, $port=80)
{
if (strlen($host)<1 || strlen($url)<1)
return false;
$ret = "";
$fp = @fsockopen ($host, $port, $errno, $errstr, 120);
if ($fp)
{
$data = "sid=&login=zzzz&pass=pssss";
$head = "POST /index.php HTTP/1.1\r\n";
$head .="Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel,application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*\r\n";
$head .="Accept-Language: ru\r\n";
$head .="Content-Type: application/x-www-form-urlencoded\r\n";
$head .="User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon)\r\n";
$head .="Host: www.mmmmm.ru\r\n";
$head .="Content-Length: ".strlen($data)."\r\n";
$head .="Connection: Keep-Alive\r\n";
$head .="Cache-Control: no-cache\r\n";
$head .="\r\n";
$head .=$data;
fputs ($fp, $head);
stream_set_timeout($fp,1);
$i=0;
while (false !== ($str = fgets($fp)))
{
$str=trim($str);
$ret[i++]=$str;
}
fclose ($fp);
}
return $ret;
}
$host='www.mmmmm.ru';
$form='/index.php';
$sid = poster($host, $form, 80);
?>
|
в сид вы получаете массив строк хтмл страницы
кое чего может и лишнее там но главное работает
p.s. правил просто в спешке | |
| |
|