
01.02.2008, 03:43
|
|
Постоянный
Регистрация: 11.10.2007
Сообщений: 406
С нами:
9780227
Репутация:
1423
|
|
Нужна помощь. Имеется такой HTTP запрос
POST http://site.ru/script.cgi HTTP/1.0
Host: site.ru
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: Accept-Language: uk
Connection: keep-alive
Referer: http://site.ru/page1
Cookie: id=12345678
Content-Type: multipart/form-data; boundary=---------------------------89463267115936
Content-Length: 441
-----------------------------89463267115936
Content-Disposition: form-data; name="qqqq"
qwer
-----------------------------89463267115936
Content-Disposition: form-data; name="qqqw"
qwer
-----------------------------89463267115936
Content-Disposition: form-data; name="qqqa"
qwer
-----------------------------89463267115936
Content-Disposition: form-data; name="qqqc"
qwer
-----------------------------89463267115936--
Мне нужно отправить его из скрипта сокетом. Правильно ли я оформил HTTP запрос в переменной $in ?
PHP код:
$in = "POST http://site/script.cgi HTTP/1.0\n";
$in .= "Host: mail.rambler.ru\n";
$in .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\n";
$in .= "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\n";
$in .= "Accept-Language: Accept-Language: uk\n";
$in .= "Connection: keep-alive\n";
$in .= "Referer: http://site.ru/page1\n";
$in .= "Cookie: id=".$id."\n";
$in .= "Content-Type: multipart/form-data; boundary=---------------------------89463267115936\n";
$in .= "Content-Length: 449\n\n";
$in .= "-----------------------------89463267115936\n";
$in .= "Content-Disposition: form-data; name=\"qqqq\"\n";
$in .= "\n";
$in .= "qwer\n";
$in .= "-----------------------------89463267115936\n";
$in .= "Content-Disposition: form-data; name=\"qqqw\"\n";
$in .= "\n";
$in .= "qwer\n";
$in .= "-----------------------------89463267115936\n";
$in .= "Content-Disposition: form-data; name=\"qqqa\"\n";
$in .= "\n";
$in .= "qwer\n";
$in .= "-----------------------------89463267115936\n";
$in .= "Content-Disposition: form-data; name=\"qqqc\"\n";
$in .= "\n";
$in .= "qwer\n";
$in .= "-----------------------------89463267115936--\n";
$in .= "\n";
fputs($socket,$in);
|
|
|