test if file exists on http-server

R. Hillen mail at richard-hillen.de
Mon Sep 3 14:35:25 EDT 2007


Hello Andre, Hello Jan,
Thank you very much!
Richard.



> Message: 11
> Date: Sun, 2 Sep 2007 21:46:29 +0200
> From: "R. Hillen" <mail at richard-hillen.de>
> Subject: test if file exists on http-server
> To: use-revolution at lists.runrev.com
> Message-ID: <80A36FE4-E1FE-4836-A47C-25DFBC71D66B at richard-hillen.de>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> Hello list,
>
> I have to check some hundred files, if they are available on  http-
> server; as they are big, is there another way than to try to download
> them?
>
> Thank you!
> Richard.
>
>
> ...


>
> Richard,
> use the HEAD method. it will respond with the headers only, no  
> content.
> check the follwing entries in the documentation.
>
> libURLSetCustomHTTPHeaders (you'll use that to assemble a HEAD request
> instead of a GET one)
>
>
> libURLLastRHHTTPHeaders (use this to check what the server answered.)
>
> you may find additional info on the HTTP protocol by reading
>
> http://www.jmarshall.com/easy/http/
>
> best
> andre


>
> That's what the 'HEAD' command is for, but since that
> doesn't seem to be in libURL, here's a helper function
> that I cooked up.
>
> ##
> on mouseUp
> ...

> end qrtHTTP_FileExists
> ##
>
> This function does not take into account the
> possibility that the file was moved and there's a
> redirect to the new location. If you don't intend on
> moving the file, the above should work just fine.
>
> Hope this helped,
>
> Jan Schenkel.





More information about the use-livecode mailing list