DELPHI有辦法寫"檢查網頁有更新後,並立即通知的功能嗎 |
尚未結案
|
seedbcc
高階會員 發表:232 回覆:272 積分:105 註冊:2003-12-10 發送簡訊給我 |
|
supman
尊榮會員 發表:29 回覆:770 積分:924 註冊:2002-04-22 發送簡訊給我 |
您好:
小弟沒做過這樣東西,不過這個應該能辦到吧.
您的連結主頁去把每一個連結的檔案抓下來,存起來,當下一次,如:一天後再抓一次,進行比對,檔案如果不一樣大,或者內容也被變更了,就發E-Mail通知您.
抓網頁的方式可以參考下面: http://delphi.ktop.com.tw/topic.php?topic_id=31852
http://delphi.ktop.com.tw/topic.php?topic_id=56611 發表人 - supman 於 2005/04/25 18:24:29
|
pcboy
版主 發表:177 回覆:1838 積分:1463 註冊:2004-01-13 發送簡訊給我 |
|
seedbcc
高階會員 發表:232 回覆:272 積分:105 註冊:2003-12-10 發送簡訊給我 |
|
supman
尊榮會員 發表:29 回覆:770 積分:924 註冊:2002-04-22 發送簡訊給我 |
|
seedbcc
高階會員 發表:232 回覆:272 積分:105 註冊:2003-12-10 發送簡訊給我 |
|
pcboy
版主 發表:177 回覆:1838 積分:1463 註冊:2004-01-13 發送簡訊給我 |
Delphi 7 Enterprise 寫的, 確認是可以正常執行的 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, ComCtrls, Shellapi, IdTCPServer, IdSMTPServer, IdMessageClient, IdSMTP, IdMessage; type TForm1 = class(TForm) Memo1: TMemo; Memo2: TMemo; Memo3: TMemo; Label1: TLabel; Memo4: TMemo; Label2: TLabel; Button1: TButton; IdHTTP1: TIdHTTP; RichEdit1: TRichEdit; Button2: TButton; IdSMTP1: TIdSMTP; IdMessage1: TIdMessage; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; DateString, TimeString : String; YearStr, MonthStr, DayStr, HourStr, MinStr, SecStr : String; AMPM : String; CurDateTime : String; BackupFileName : String; ChangeFileName : String; CompareFileName : String; implementation {$R *.dfm} procedure FileNameMake; begin // ***************** 計算目前的年月日時分秒當檔案名稱使用 ****************** DateString := DateToStr(date); TimeString := TimeToStr(Time); YearStr := DateString[1] DateString[2] DateString[3] DateString[4] ; if (DateString[7]='/') then // 月份為1個數字, 1-9 月 begin MonthStr := '0' DateString[6]; //月份補成 2 位 if (DateString[9]='') then // 日期為 1 個數字 DayStr := '0' DateString[8] else DayStr := DateString[8] DateString[9]; end else // 月份為2個數字, 10-12 月 begin MonthStr := DateString[6] DateString[7]; if (DateString[10]='') then DayStr := '0' DateString[9] else DayStr := DateString[9] DateString[10]; end; AMPM:=TimeString[1] TimeString[2] TimeString[3] TimeString[4]; HourStr := TimeString[6] TimeString[7]; if (AMPM='上午') and (HourStr='12') then HourStr := '00'; if (AMPM='下午') and (HourStr<>'12') then HourStr := IntToStr(StrToInt(HourStr) 12); MinStr := TimeString[9] TimeString[10]; SecStr := TimeString[12] TimeString[13]; CurDateTime := YearStr MonthStr DayStr '-' HourStr MinStr SecStr; //******************************************************************** // 設定儲存 Log 檔名 BackupFileName := 'Log\Symantec' CurDateTime '.htm'; ChangeFileName := 'Log\Symantec' CurDateTime 'Var.htm'; CompareFileName := 'Log\Symantec.htm'; end; procedure TForm1.Button1Click(Sender: TObject); var i, j : integer; s : String; VirusDataStart : integer; VirusDataEnd : integer; Same : integer; // Attachment: TIdAttachment; // 自己要加上, 郵寄附件 EmailCount : integer; begin RichEdit1.PlainText:=True; // 設定 RichEdit1 讀取的資料當純文字 // 初始化值 Button1.Enabled := False ; Button1.Caption := '執行中'; RichEdit1.Lines.Clear; Memo1.Lines.Clear; Memo2.Lines.Clear; Memo3.Lines.Clear; Memo4.Lines.Clear; FileNameMake; // 記算日期時間當檔案名稱; if FileExists('email.txt') then Memo3.Lines.LoadFromFile('email.txt'); { // Memo1 讀取的網頁不回自動換行 , 改用 RichEdit1 Memo1.Lines.Clear; IdHTTP1.HandleRedirects:=true; Memo1.Text:=IdHTTP1.Get('http://www.symantec.com.tw/'); } // 讀取網頁 IdHTTP1.HandleRedirects:=true; RichEdit1.Text:=IdHTTP1.Get('http://www.symantec.com.tw/'); Memo4.Lines.Add('讀取Symantec網頁內容'); // 找尋病毒資訊開始行 VirusDataStart:=0; VirusDataEnd:=0; i:=0; while (i < RichEdit1.Lines.Count) and (VirusDataStart=0) do begin s:=''; if (StrLen(PChar(RichEdit1.Lines[i]))>=12) then begin for j:=1 to 12 do s:= s RichEdit1.Lines[i][j]; if (s='最新安全威脅') then begin VirusDataStart := i; Memo4.Lines.Add('資料開始行 : ' IntToStr(VirusDataStart)); end; end; i:=i 1; end; // 找尋病毒資訊結束行 while (i < RichEdit1.Lines.Count) and (VirusDataEnd=0) do begin s:=''; if (StrLen(PChar(RichEdit1.Lines[i]))>=8) then begin for j:=1 to 8 do s:= s RichEdit1.Lines[i][j]; if (s=' |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |