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;

解决方案 »

  1.   

    我是做,bs和cs结合的,就是在cs登录后,点击某个按钮,能直接登录到bs的网站后台。不知道有啥好办法
      

  2.   

    如果你模拟提交的包是登陆后台的
    那么直接 post后就是后台的页面了
    你可以把POST后的数据保存在一个变量里看一下就知道了
      

  3.   

    IDHTTP一般是用于模拟发包用的,比如你想要在网站用某一动作,就可以用IDHTTP来模拟。
      

  4.   

        那你还不如直接在webbrowser里做登录,在页面下载完后,自动填帐密和登录,用idhttp登录后,用IE显示登录后的估计不行,就算是能做,估计也是离线的