IDHTTP能直接打开IE吗

czkun 2010-08-12 11:16:28
IDHTTP能直接打开IE吗,我直接post用户名和密码后,直接调用IE打开网站的后台


procedure TForm1.btnLoginClick(Sender: TObject);
var
s, s1: TStringStream;
i: Integer;
begin
s := TStringStream.Create( ' ');
s1 := TStringStream.Create( ' ');
//http.HandleRedirects:=False;
//http.OnRedirect:=MyRedirect;
http.HandleRedirects:=true;
http.HTTPOptions:=http.HTTPOptions+[hoKeepOrigProtocol];//关键这行
// http.ProtocolVersion:=pv1_1;
http.Request.ContentType:='application/x-www-form-urlencoded';


try
s.WriteString( 'name= ' + edtUserName.Text + '& ');
s.WriteString( 'email= ' + edtPassword.Text);
http.Request.ContentType := 'application/x-www-form-urlencoded ';

try
http.Post( 'http://10.241.96.17/aa.asp ', s, s1);

except
http.Get(http.Response.Location, s1);
end;
http.Request.Referer:='http://10.241.96.17/aa.asp';
http.HandleRedirects:=true;
//}
Memo1.Lines.Text := s1.DataString;
//下面的是显示cookies信息的代码
Cookies.Clear;
Cookies.Lines.Add(inttostr(CookieManager.CookieCollection.Count));
for i := 0 to CookieManager.CookieCollection.Count - 1 do
Cookies.Lines.Add(CookieManager.CookieCollection.Items[i].CookieText);
finally
s.Free;
s1.Free;
end;


end;
...全文
125 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
likeyrain 2010-11-17
  • 打赏
  • 举报
回复
那你还不如直接在webbrowser里做登录,在页面下载完后,自动填帐密和登录,用idhttp登录后,用IE显示登录后的估计不行,就算是能做,估计也是离线的
hulong_123456 2010-11-16
  • 打赏
  • 举报
回复
是不是把客户端当做浏览器啊?这个我做过 用的是框架
slmax1 2010-08-15
  • 打赏
  • 举报
回复
IDHTTP一般是用于模拟发包用的,比如你想要在网站用某一动作,就可以用IDHTTP来模拟。
czkun 2010-08-12
  • 打赏
  • 举报
回复
没有人有做过这方面的吗
czkun 2010-08-12
  • 打赏
  • 举报
回复
我是做,bs和cs结合的,就是在cs登录后,点击某个按钮,能直接登录到bs的网站后台。不知道有啥好办法
Mit1208 2010-08-12
  • 打赏
  • 举报
回复
如果你模拟提交的包是登陆后台的
那么直接 post后就是后台的页面了
你可以把POST后的数据保存在一个变量里看一下就知道了

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧