⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 DELPHI的web信息采集程序
💻 PAS
字号:
/// 采集源代码
///版权所有@中国要发的 www.cn18.de
///QQ:72012
///2006、2、12

unit Unit1;

interface

uses
  Windows,Messages, SysUtils, Forms,
  IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdHTTP, StdCtrls, Controls, Classes, OleCtrls, SHDocVw;

type
  TForm1 = class(TForm)
    IdHTTP1: TIdHTTP;
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Edit1: TEdit;
    Web1: TWebBrowser;
    Label6: TLabel;
    Edit2: TEdit;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
re,s,number:string;
begin
if edit1.text='' then
   begin
   messagebox(handle,'请输入需要查询的网站地址!','提示',64);
   exit;
   end;

number:=trim(edit1.text);
idhttp1.Get('http://www.cn18.de');       ///   这个意思就是先访问这个页面
idhttp1.Get('http://alexa.chinaz.com/?domain='+number+'');           ///   然后访问这个页面
re:=idhttp1.Get('http://alexa.chinaz.com/?domain='+number+'');          ///   最后读取这个页面源代码

s:=copy(re,pos('<td width="100" align="left">',re)+29,99999);
/// +29意思就是前规律的字符数(可以用我提供的软件查)  99999是规律中的截取数据字符。
s:=copy(s,1,pos('</td>',s)-1);
s:=stringreplace(s,'&nbsp;',' ',[rfReplaceAll]);
Label1.Caption:='综合排名:'+s;          /// s 就是我们截取到的内容

s:=copy(re,pos('<td width="174" align="left">',re)+29,99999);
s:=copy(s,1,pos('</td>',s)-1);
Label2.Caption:='收录日期:'+s;

s:=copy(re,pos('量</td></tr><tr class="data"><td>',re)+33,100);
s:=copy(s,1,pos('</td>',s)-1);
s:=stringreplace(s,'&nbsp;',' ',[rfReplaceAll]);
Label3.Caption:='日均 IP 访问量:'+s;






end;


    end.

    /// 采集源代码
///版权所有@中国要发的 www.cn18.de
///QQ:72012

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -