我想做一个网页登录器.
比如登陆网易.我有多个邮箱账号.任意点击一个用户名后自动登陆改账号.
请问怎么实现?
有源代码共参考最好,先谢了

解决方案 »

  1.   

    安装个httpwatch之类的工具来监测登录时所提交的数据,用IdHttp控件来Get/Post数据,就可以实现
      

  2.   

    用IdHttp控件来Get/Post数据,就可以实现
      

  3.   

    没有验证码的话直接在webbrowser上获取ole对象,填充数据提交表单.
    有验证码就麻烦了.
      

  4.   

    给你个例子,SendKeys 函数可以到网上搜一下,下载下来
    procedure TMainForm.BtLoginClick(Sender: TObject);
    var
      Docs, ovElements: OleVariant;
      i: Integer;
    begin
      try
        BtLogin.Enabled:=False;
        sName:=CbName.Text;
        sPassword:=sName;
        if (Trim(sName)='') or (Trim(sPassword)='') then Exit;
        Docs := WB.OleObject.Document;
        ovElements := Docs.GetElementByID('username');
        ovElements.Value :=sName;
        ovElements.Focus;
        Application.ProcessMessages;
        ovElements := Docs.GetElementByID('password');
        ovElements.Value :=sPassword;
        Application.ProcessMessages;
        Sleep(1*1000);
        SendKeys('~',true);
        i:=0;
        while i<500 do
        begin
          i:=i+1;
          Application.ProcessMessages;
          Sleep(10);
        end;
        Sleep(1*1000);
        WB.Navigate(sUrlMy);
      finally
        BtLogin.Enabled:=True;
      end;
    end;
      

  5.   

    我写过 用的 webbrowser 实现的呵呵