
24.04.2008, 01:42
|
|
Постоянный
Регистрация: 30.09.2007
Сообщений: 815
Провел на форуме: 2590715
Репутация:
659
|
|
PHP код:
$answer = request("site.com", "/script.php", "POST", "", "param1=a¶m2=b");
function request($host, $path, $type, $cookie, $content){
$len = strlen($content);
$query = "$type $path HTTP/1.1\r\n".
"User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n".
"Host: $host\r\n".
"Content-Type: application/x-www-form-urlencoded\r\n".
"Cookie: $cookie\r\n".
"Connection: close\r\n".
"Content-Length: $len\r\n".
"\r\n".
$content;
writelog("QUERY: $query");
$conn = fsockopen($host, 80, $errno, $errstr, 1000);
fputs($conn, $query);
$response="";
while (!feof($conn))
{
$response.= fgets($conn, 128);
}
fclose($conn);
writelog("RESPONSE: $response");
return $response;
}
|
|
|