[Gambas-user] best way to monitor remote URL/file in gambas2

Doriano Blengino doriano.blengino at ...1909...
Tue Oct 13 16:50:53 CEST 2009


M0E Lnx ha scritto:
> All I want is to compare the contents. For exmple, say yesterday I
> checked ftp://ftp-osl.osuosl.org and it reported this
> foo/
> bar/
>
> And today, I check again and it has
> foo/
> bar/
> foo-bar-1.0.tar.gz
>
> I Want to be able to detect the new "foo-bar-1.0.tar.gz"
>   
Yes, this is clear. What was not clear was your last mail, where you 
said a thing and nearly the contrary.

Back to the topic. There are two ways to do it in http. One is to GET 
the url, and compare the result (a stream of characters) with a previous 
copy. It should work pretty the same as ftp, but clearly you can use a 
browser, point it to your url, and see for yourself what the result is. 
I think the result should be a listing, just the same as ftp (only some 
html tag added to beautify). Look if there is some footer like 
"Generated by Apache on blah blah blah", where "blah blah blah" could be 
a date; that footer can be a problem and should be discarded if it 
contains a date.

The other way is to use the "/If-Modified-Since"/  http header, or other 
http functionalities (sorry, don't have the docs at hand). This involves 
no data transfer - the client asks the server if an URI has been 
modified *after* a certain timestamp. This is exactly what you want, in 
the most effective way. If your URI refers to a listing of files, then 
this facility would say you if the listing has been modified (some files 
were be added, deleted, modified) after a certain date.

Both the methods must be verified (by you, in your context); I don't 
know how to implement them in gambas - never used such component. But if 
you know what you want, then someone else can explain you what to do in 
gambas.

Regards,
Doriano




More information about the User mailing list