procedure SendUrl(Url,Data: string;
var ADataIn: TStringList);
var
Response : TStringStream;
tmpStr: TStringList;
tmpHTTP: TIdHTTP;
begin
tmpHTTP:= TIdHTTP.Create(self);
try
tmpHTTP.Request.ContentType := 'application/x-www-form-urlencoded';
Response := TStringStream.Create('');
tmpStr:= TStringList.Create;
tmpStr.Clear;
tmpStr.Add(Data);
tmpHTTP.Post(Url, tmpStr, Response);
ADataIn.Text:= Response.DataString;
Response.Free;
tmpStr.Free;
finally
tmpHTTP.Free;
end;
end;
肯定可以成功,我已经试过了。
其中,
url: http://my.chinahr.com/login.asp
data: action=http://my.chinahr.com/login.asp&txtname=你的用户名&UserName=&txtpwd=你的密码&PassWord=&txtwho=1
ADataIn: 返回页面,要先创建。