在Form中放入TNMHttp控件,如下就能得到更新时间:
procedure TForm1.Button1Click(Sender: TObject);
begin
NMHttp1.Head(Edit1.Text);
end;
procedure TForm1.NMHTTP1Success(Cmd: CmdType);
var
i:integer;
TempString:string;
OneHead:string;
ModifiedTime:string;
begin
TempString:=NMHttp1.Header;
ModifiedTime:='';
repeat
i:=pos(#13+#10,TempString);
if i=0 then
i:=Length(Tempstring)+1;
if i<>0 then
begin
OneHead:=Copy(TempString,1,i-1);
Delete(TempString,1,i-1);
if Length(TempString)>0 then
Delete(Tempstring,1,2);
if pos('LAST-MODIFIED:',uppercase(OneHead))>0 then
ModifiedTime:=OneHead;
end;
until Length(TempString)=0;
if Length(ModifiedTime)>0 then
ShowMessage(ModifiedTime);
end;