网址 http://218.205.192.16
就这个网站的验证码。如何读取到?
该网站在运行后,源代码中就有验证码可以读取出来。!
求怎么读?

解决方案 »

  1.   

    就这个网页吧。。 其他一般是要通过图片来处理的。。这个网页在打开后,直接就可以在源代码读取出来的。。 但是好像用idhttp.get获得源代码又没有!
      

  2.   

    新建工程、双击窗体,将下列代码覆盖你的Unit1全部内容:
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, OleCtrls, SHDocVw, ExtCtrls, IdHTTP, jpeg;type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
        procedure Button1Click(Sender: TObject);
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation
    {$R *.dfm}var WebBrowser1:TWebBrowser;
        Button1:TButton;
        Image1: TImage;procedure TForm1.FormCreate(Sender: TObject);
    begin
      Caption:='中国软件研发联盟Q群122058606_广州佬';
      Height:=360;
      Width:=580;
      Position:=poScreenCenter;
      Button1:=TButton.Create(self);
      Button1.Parent:=Form1;
      Button1.Left:=450;
      Button1.Top:=260;
      Button1.Caption:='获取';
      Button1.OnClick:=Button1Click;
      WebBrowser1:=TWebBrowser.Create(self);
      TWinControl(WebBrowser1).Parent:=Form1;
      WebBrowser1.Navigate('about:blank');
      WebBrowser1.Align:=alLeft;
      WebBrowser1.Width:=425;
      Image1:=TImage.Create(self);
      Image1.Parent:=Form1;
      Image1.AutoSize:=true;
      Image1.Top:=160;
      Image1.Left:=450;
      Image1.Height:=40;
      Image1.Width:=80;
    end;procedure TForm1.Button1Click(Sender: TObject);
    const URL= 'http://218.205.192.16';
    var s:string;
        pic:TJPEGImage;
        ms:TMemoryStream;
        IdHTTP:TIdHTTP;
    begin
      WebBrowser1.Navigate(URL);
      while webbrowser1.ReadyState <>READYSTATE_COMPLETE do
          Application.ProcessMessages;
      s:=WebBrowser1.OleObject.Document.parentWindow.form1.checkCodeTemp.value;
      if s='' then exit;
      Canvas.TextOut(450,200,'验证码: '+s);
      //以下显示图片:
      IdHTTP:=TIdHTTP.Create(self);
      try
        ms:=TMemoryStream.Create;
        try
          IdHTTP.Get(URL+'/ucas/user/pasmCheckCode.htm?rand='+s, ms);
          ms.Position:=0;
          pic:=TJPEGImage.Create;
          try
            pic.LoadFromStream(ms);
            Image1.Picture.Assign(pic);
          finally
            pic.Free;
          end;
        finally
          ms.Free;
        end;
      finally
        IdHTTP.Free;
      end;
    end;end.
      

  3.   

    汗,四楼这样得到我也想到了。。 只是这样得到的验证码,我要用idhttp.post登录也用不了啊。。~
      

  4.   

    要用idhttp.post登录也不是难事,我回了你帖子的问题了,结了这贴后再开一贴,我回你。