获得一个页面的网址,然后就是把网页中的文章取出来!多谢了!

解决方案 »

  1.   

    mStr := IdHttp1.Get(mUrl);mStr即为网页的内容,过滤方法是先分析mStr的特点,找到关键的子字符串,然后在mStr里定位子字符串的位置,剔除无用字符串即可。
      

  2.   

    http://news3.xinhuanet.com/politics/2006-07/09/content_4810516.htm
    分页可不考虑,多谢了!
      

  3.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
      IdTCPClient, IdHTTP, StrUtils;type
      TForm1 = class(TForm)
        IdHTTP1: TIdHTTP;
        Button1: TButton;
        Memo1: TMemo;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    var
            mStr: string;
            mKey1,mKey2: string;
    begin
            mKey1 := '<P><STRONG><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;';
            mKey2 := '<P align="center" class="pagelink">';
            mStr := IdHttp1.Get('http://news3.xinhuanet.com/politics/2006-07/09/content_4810516.htm');
            //根据关键字找到文章开始部分
            mStr := RightBStr(mStr,Length(mStr)-Pos(mKey1,mStr)+1);
            //根据关键字找到文章结束部分
            mStr := LeftBStr(mStr,Pos(mKey2,mStr)-1);
            Memo1.Lines.Clear;
            Memo1.Lines.Add(mStr);
    end;end.
      

  4.   

    mStr里面还有些html的标记,你可以找到位置后,用delete函数去除掉,具体请看一下这个函数的帮助吧。