今天写了个自动抢沙发的东西,
先登录,然后5秒看有没有0回复的帖子,
有的话就获取id,post发帖子,
无奈,idhttp就是不记录cookie,
导致发的时候一直显示未登录,这是怎么回事?
服务器返回的http头  
这儿是有 Set-Cookie的 可是后面idhttp一个都不带上HTTP/1.1 200 OK
Server: nginx/0.8.31
Date: Wed, 31 Mar 2010 07:27:38 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.2.11
Set-Cookie: bbs_sid=TqfS4PdZy412700204580.63782800; expires=Wed, 07-Apr-2010 07:27:38 GMT; domain=.xoyo.com; httponly
Load-Balance: 10.19.1.236登录函数procedure TForm1.login;
var
  strs:tstringstream;
  s:string;
begin
  idhttp1.AllowCookies:=true;
  idhttp1.HandleRedirects:=true;
  idhttp1.Request.Referer:='http://jx3.bbs.xoyo.com/logging.php?action=login';
  idhttp1.Request.UserAgent:='Opera/9.80 (Windows NT 5.1; U; zh-cn) Presto/2.6.22 Version/10.50';
  idhttp1.Request.ContentType:='application/x-www-form-urlencoded';
  s:=idhttp1.Get('http://jx3.bbs.xoyo.com/logging.php?action=login');
  cook:=cook+(idhttp1.Response.RawHeaders.Values['Set-Cookie']);
  formhash:=copy(s,pos('formhash" value=',s)+17,8);
  strs:=tstringstream.Create;
  strs.WriteString('formhash='+formhash+'&referer=http%3A%2F%2Fjx3.bbs.xoyo.com%2Fforumdisplay.php%3Ffid%3D7101%26page%3D1&loginfield=username&username=gongzi%40live.hk&password=bugaosuni&answer=&loginsubmit=true&cookietime=2592000');
  s:=idhttp1.Post('http://jx3.bbs.xoyo.com/logging.php?action=login&loginsubmit=yes',strs);
  cook:=cook+(idhttp1.Response.RawHeaders.Values['Set-Cookie']);
  if pos('欢迎您回来',s)<>0 then
  memo1.Lines.Add('登录成功!');
  strs.Free;end;
抢 杀花 函数
procedure TForm1.check;
var
 s:string;
 id:string;
 strs:tstringstream;
begin
  idhttp1.Request.Referer:='http://jx3.bbs.xoyo.com/forumdisplay.php?fid=7101&page=1';
  s:=idhttp1.Get('http://jx3.bbs.xoyo.com/forumdisplay.php?fid=7101&page=1');
  s:=copy(s,pos('版块主题',s),50000);
  if pos('<strong>0</strong>',s)<>0 then
    begin
    s:=copy(s,pos('<strong>0</strong>',s)-300,330);
    id:=copy(s,pos('viewthread.php?tid=',s)+19,8);    strs:=tstringstream.Create;
    strs.WriteString('formhash='+formhash+'&subject=&usesig=0&message=%5Bcq22%5D%E6%9D%80+%7E%7E%7E%7E%7E%7E%7E%7E%E8%8A%B1%7E%7E%7E%7E%7E%7E%7E%7E%7E%7E%7E%7E%7E%7E%7E%7E%7E%7E%7E%7E');
    idhttp1.Request.CustomHeaders.Values['Cookie']:=cook;
    s:=idhttp1.Post('http://jx3.bbs.xoyo.com/post.php?action=reply&fid=7101&tid='+id+'&extra=page%3D1&replysubmit=yes&infloat=yes&handlekey=fastpost&inajax=1&local=undefined',strs);
     strs.Free;
      memo1.Lines.Add(id+'抢花成功'+s);
    end;end;