http://member1.taobao.com/member/login.jhtml?TPL_username=用户名&TPL_password=密码&Submit=登 录&actionForStable=enable_post_user_action&action=Authenticator&TPL_redirect_url=&event_submit_do_login=anything&abtest=&pstrong=1&from=用这样的链接直接在IE的地址栏可以登陆,但用Idhttp.get 却登陆不了,不知道是为什么哦
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ComObj,IdHTTP;type
TForm7 = class(TForm)
Memo_Log: TMemo;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
procedure MyRedirect(Sender: TObject; var dest: string; var NumRedirect: Integer; var Handled: boolean; var VMethod: TIdHTTPMethod);
{ Private declarations }
public
{ Public declarations }
end;var
Form7: TForm7;implementation{$R *.dfm}procedure TForm7.Button1Click(Sender: TObject);
begin
end;procedure TForm7.Button2Click(Sender: TObject);
var
PS:TStringList;
RS,RS1:TStringStream;
FHTTP:TIdHTTP;
begin
PS:=TStringList.Create;
RS:=TStringStream.Create('');
RS1:=TStringStream.Create('');
FHTTP:=TIdHTTP.Create(nil);
try
FHTTP.HandleRedirects:=False;
FHTTP.OnRedirect:=MyRedirect;
FHTTP.Request.UserAgent:='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
FHTTP.Request.ContentType:='application/x-www-form-urlencoded; Charset=UTF-8';
FHTTP.Request.Host:='member1.taobao.com';
FHTTP.Request.Connection:='Keep-Alive';
FHTTP.Request.Accept:='*/*';
PS.Add('TPL_username=用户名');
PS.Add('CtrlVersion=1,0,0,7');
PS.Add('support=000001');
PS.Add('tid=加密后');
PS.Add('TPL_password=加密后');
PS.Add('actionForStable=enable_post_user_action');
PS.Add('action=Authenticator');
PS.Add('TPL_redirect_url=');
PS.Add('event_submit_do_login=anything');
PS.Add('abtest=');
PS.Add('pstrong=');
PS.Add('from=');
PS.Add('yparam=');
PS.Add('done=');
FHTTP.Request.ContentLength:=Length(PS.Text);
FHTTP.Post('http://member1.taobao.com/member/login.jhtml',PS,RS);
FHTTP.Get('http://my.taobao.com/mytaobao/home/my_taobao.jhtml',RS1);
Memo_Log.Text:=RS1.DataString;
finally
if Assigned(FHTTP) then FreeAndNil(FHTTP);
if Assigned(PS) then FreeAndNil(PS);
if Assigned(RS) then FreeAndNil(RS);
if Assigned(RS1) then FreeAndNil(RS1);
end;
end;procedure TForm7.MyRedirect(Sender: TObject; var dest: string;
var NumRedirect: Integer; var Handled: boolean; var VMethod: TIdHTTPMethod);
begin
Handled:=True;
end;end.调试版本是Indy10.2.3,Delphi2007
我现在都是一直用GET的方法登陆的
PS.Add('TPL_password=加密后');
这个TID和TPL_password如何获取加密后的结果?