
25.11.2006, 00:25
|
|
Познающий
Регистрация: 14.11.2006
Сообщений: 66
Провел на форуме: 90989
Репутация:
5
|
|
_Great_, да
nc.STRIEM, сокеты поддерживаються, ниже скрипт (ф-ю стащил пыхпыха.нет)
PHP код:
function sendToHost($host,$method,$path,$data,$cookie='',$useragent=0){
$buf = '';
if (!$fp = fsockopen($host, 80, $errno, $errstr, 30) )
return false;
if (empty($method)) {
$method = 'GET';
}
$method = strtoupper($method);
if ($method == 'GET') {
$path .= '?' . $data;
}
$out = "$method $path HTTP/1.1\r\n";
$out .= "Host: $host\r\n";
$out .= "Referer: http://$host\r\n";
$out .= "Content-type: application/x-www-form-urlencoded\r\n";
if ($cookie){
$out .= "Cookie: $cookie" . "\r\n";
}
if ($useragent) {
$out .= "User-Agent: MSIE\r\n";
}
$out .= "Content-length: " . strlen($data) . "\r\n";
$out .= "Connection: Close\r\n\r\n";
if ($method == 'POST') {
$out .= $data;
}
if (! fwrite($fp, $out) )
return false;
while (!feof($fp)) {
$buf .= fgets($fp, 128);
}
fclose($fp);
return $buf;
}
|
|
|