Downloading mystery
Dave Cragg
dcragg at lacscentre.co.uk
Thu Nov 17 09:19:04 EST 2005
On 17 Nov 2005, at 01:42, Bruce A. Pokras wrote:
> I am trying to script the downloading of European patents from the
> European Patent Office's server. They provide a sample URL to use
> for that purpose, but instead of the patent, I instantly get a zero
> size file. I've tried it with and without URLencode. However,
> scriptiing with revGoURL works fine with the same URL to open the
> patent in my browser. Any ideas? The script I am using goes like this:
>
> on mouseup
> put "https://publications.european-patent-office.org/
> PublicationServer/getpdf.jsp?cc=EP&pn=1502503&ki=A1" into theURL
> put URL theURL into URL "binfile:1502503.pdf"
> end mouseup
>
> Could it be that Rev is allergic to JavaServer Pages? I hope not.
> Thanks for any help that you might be able to give.
<mauling_by_sheep>
This is a plea, not just to Bruce, but to all of you who do things
like this, most of whom should know better.
When you deal with URLs, especially internet URLs, things sometimes
go wrong. Often these things are outside of your control, such as the
network being busy, being given the wrong URL by your boss, your
ISP's data center being struck by an asteroid, or a dud hard drive.
It's important that you check that things happen as expected. So
every time you make a url request, always (i.e. always) check "the
result".
In the example above, there are two url requests in the same line. So
should you check the result twice? I'd say "yes". Something like this:
put URL theURL into theData
put the result into theRes
if theRes <> empty then
answer theRes ## or whatever you need to do
else
put theData into URL "binfile:1502503.pdf"
put the result into theRes
if theRes is not empty then
answer theRes ## or whatever you need to do
else
##carry on
end if
end if
</mauling over>
Apart from that, I think Ken's pointer to "libURLSetSSLVerification"
will probably work. This will mean that you won't be able to
authenticate the remote server. Perhaps OK for the patent office, but
probably not a good idea for doing bank transactions. The alternative
is to set the sslCertificates property to an appropriate certificates
file.
Cheers
Dave
More information about the use-livecode
mailing list