我用这段代码的话 如果原网页不需要登录的话 是可以用的
但是原网页需要登录后才可以发帖。请问如何带上cookie呢?
uses IDHTTP;
Var
Response:string;
Paramstr:Tstringlist;
IdHTTP1:Tidhttp;
begin
IdHTTP1:=Tidhttp.create(nil);
Paramstr:= TStringList.Create;
Paramstr.Add('name=333333');
Paramstr.Add('submit=%CC%E1%BD%BB');
IdHTTP1.Request.Referer := 'http://localhost/post/index.php';
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; CIBA; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)';
Response:=IdHTTP1.Post(url, Paramstr);
showmessage(Response);
Freeandnil(IdHTTP1);
Paramstr.Free;
end;
我把包截下来了 大家帮忙分析下。。谢谢了
========================================================
POST /forum.php?mod=post&action=reply&fid=204&tid=2447971&extra=%26page%3D1&replysubmit=yes&infloat=yes&handlekey=fastpost&inajax=1 HTTP/1.1
Accept: application/x-shockwave-flash, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/msword, application/QVOD, application/QVOD, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*
Referer: http://bbs.xxxxxxxxx.com/forum.php?mod=post&action=reply&fid=204&tid=2447971&extra=%26page%
Accept-Language: zh-cn
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; CIBA; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)
Host: bbs.admin5.com
Content-Length: 77
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: QRNq_2132_lastvisit=1299575504; QRNq_2132_sid=6aFHuE; QRNq_2132_lastact=1300763841%09home.php%09misc; cnzz_a30042864=3; sin30042864=none; rtime30042864=1; ltime30042864=1300764168687; cnzz_eid30042864=95466335-1299578956-; admin5_com=admin5_com; QRNq_2132_auth=6db8CS1hjpBL8ecZFcl%2BGGXEASn%2BFMPf9I%2F395LUpOHWkAhziE5jfNz0HZeg1PklV4%2F%2FSW4z7pUf0qbf%2FiUuu%2FycHv4; QRNq_2132_connect_is_bind=0; QRNq_2132_oldtopics=D2447971D; QRNq_2132_smile=3D1; QRNq_2132_editormode_e=1; QRNq_2132_fid204=1300763812
message=%C3%B2%CB%C6%B2%BB%C4%DC%B7%A2%C1%CB%B0%C9&formhash=880ae239&subject=
===================================================================
注明:网站域名我屏蔽掉了。嘎嘎。