
04.02.2009, 00:00
|
|
Участник форума
Регистрация: 31.07.2008
Сообщений: 207
С нами:
9356941
Репутация:
107
|
|
Чакус, не только. (Content-Length ?  )
Мылокисть, лови готовую фичу post-sock
PHP код:
function post($ip, $port = 80, $path, $zapros, $cookie){
$res="";
$sock=fsockopen($ip,$port, $errno, $errstr, 30);
if(!$sock){
echo $errstr($errno);
} else {
$headers ="POST $path HTTP/1.0\r\n";
$headers .="Host: rambler.ru\r\n";
$headers .="User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.14)\r\n";
$headers .="Accept-Language: ru,ru-RU;q=0.9,en;q=0.8\r\n";
$headers .="Cookie: $cookie\r\n";
$headers .="Pragma: no-cache\r\n";
$headers .="Content-Type: application/x-www-form-urlencoded\r\n";
$headers .="Content-Length: " . strlen($zapros) . "\r\n";
$headers .="Connection: Close\r\n\r\n";
$headers .=$zapros;
}
fwrite($sock, $headers);
while(!feof($sock)){
$res .=fgets($sock, 1024);
}
return $res;
}
Юзается в туче реггеров )
|
|
|