procedure TForm1.btnLoginClick(Sender: TObject);
var
  s, Response: TStringStream;
  i: Integer;
begin
  s := TStringStream.Create('');
  Response := TStringStream.Create('');
  try
    s.WriteString('&TPL_username=用户名);
    s.WriteString('&TPL_password=密码');
    s.WriteString('&Submit=登 录');
    s.WriteString('&CtrlVersion=1,0,0,7');
    s.WriteString('&support=000001');
    s.WriteString('&tid=');
    s.WriteString('&actionForStable=enable_post_user_action');
    s.WriteString('&TPL_redirect_url=');
    s.WriteString('&event_submit_do_login=anything');
    s.WriteString('&abtest=');
    s.WriteString('&pstrong=');
    s.WriteString('&from=');
    s.WriteString('&yparam=');
    s.WriteString('&done=');
    http.HandleRedirects:=true;
http.Request.Connection:='Keep-Alive';
http.Request.CacheControl:='no-cache';
http.Request.Accept:='image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, */*';
http.Request.ContentType:= 'application/x-www-form-urlencoded';
http.Request.UserAgent:='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)';
http.Request.host:='member1.taobao.com';http.Request.Referer:='http://member1.taobao.com/member/login.jhtml';    try
      http.Post('http://member1.taobao.com/member/login.jhtml', s, Response)
    except
      http.Get(http.Response.Location, Response);
    end;
    
    //Memo1.Lines.Text:=http.Get('http://auction1.taobao.com/auction/goods/goods_on_sale.htm');
     Memo1.Lines.Text := Response.DataString;  finally
    s.Free;
    Response.Free;
  end;end;

解决方案 »

  1.   

    看起来你代码没什么问题的,返回页面信息你没有仔细看,不是首页.
    而是输入密码错误后跳到的登录页.是的,我判断你问题就在密码这儿。你打开淘宝网页看看源码,它输入密码的地方,应该是使用了一个安全控件。
    这样它在HTTP POST时候,密码参数TPL_password应该不是原始的密码串了。
      

  2.   

    我说错了 是返回到登陆页,密码是没有错的,因为我用java的话 也是一样的原始密码,一样的参数,是 可以登陆的
      

  3.   

    在java中的话,要第二次请求才能登陆成功,因为第一次post的时候,淘宝会返回转向另一个页面HTTP/1.1 302 Moved Temporarily,
    这个时候要获取转向的页面地址,发送GET 这个页面的地址,才能登陆成功.
    我不知道 delphi 怎样去获得这个转向的地址?
      

  4.   

    自己硬性设定~
    或者获取跳转链接,然后get~