Board index » delphi » Checking a http file's modified status using Indy...

Checking a http file's modified status using Indy...

Hi All
   Is there an example anywhere of how to check a html file's modified
date using the Indy components. For example I would like my app to
connect to a server and check to see is a page or file on my server has
changed. I'm sure self updating programs use this technique to find out
if there is a new version of the software available.

Thanks in advance for any hints.

Dominique

 

Re:Checking a http file's modified status using Indy...


Do a HEAD with IdHTTP and examine the headers field for the date.

Re:Checking a http file's modified status using Indy...


Hi Hadi,
   Thanks for the reply. Will this also work for a file on a FTP server
or do I have to use something different in that case?

Thanks

Dominique
http://www.DelphiGamer.com

Hadi Hariri - Team Indy wrote:

Quote
> Do a HEAD with IdHTTP and examine the headers field for the date.

Re:Checking a http file's modified status using Indy...


Hi Hadi,

Hadi Hariri - Team Indy wrote:

Quote
> Do a HEAD with IdHTTP and examine the headers field for the date.

Pardon my ignorance but what does "Do a HEAD" with idHTTP mean?
I just found a property called Request ( part of idHTTP ) which contains
a LastModified TDateTime but it always seems to return 30/12/1899.  It
would seem I am using it incorrectly when I type...
Memo1.Lines.Add( DateTimeToStr(HTTP.Request.LastModified) );

Or does this property not work?

Thanks.

Dominique

Re:Checking a http file's modified status using Indy...


There is e method Head that does HEAD request.

Doychin

Quote
"Dominique Louis" <Dominq...@SavageSoftware.com.au> wrote in message

news:3B4C4A0A.1070505@SavageSoftware.com.au...
Quote
> Hi Hadi,

> Hadi Hariri - Team Indy wrote:

> > Do a HEAD with IdHTTP and examine the headers field for the date.
> Pardon my ignorance but what does "Do a HEAD" with idHTTP mean?
> I just found a property called Request ( part of idHTTP ) which contains
> a LastModified TDateTime but it always seems to return 30/12/1899.  It
> would seem I am using it incorrectly when I type...
> Memo1.Lines.Add( DateTimeToStr(HTTP.Request.LastModified) );

> Or does this property not work?

> Thanks.

> Dominique

Re:Checking a http file's modified status using Indy...


Thanks to all who replied I found that the solution was extremely easy...
HTTP.Response.LastModified will give you the LastModified Date of the
file in TDateTime format and HTTP.Response.Expires will give you the
expiry date in TDateTime format. Remember to do a HTTP.Get(
'http://www.TheWebPage.com' ); first so that these properties are primed
for action.

L8R,

Dominique.

Quote
Dominique wrote:
> Hi All
>   Is there an example anywhere of how to check a html file's modified
> date using the Indy components. For example I would like my app to
> connect to a server and check to see is a page or file on my server has
> changed. I'm sure self updating programs use this technique to find out
> if there is a new version of the software available.

> Thanks in advance for any hints.

> Dominique

Other Threads