Downloading mystery

Bruce A. Pokras macstacks at earthlink.net
Thu Nov 17 20:53:57 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

Thanks, Dave, for the mauling. It was well deserved. However, I have 
been trying to get this to work over a period of several weeks. This 
was not a "try once and cry for help." This has been a long, drawn 
out bit of frustration. A couple of times I did throw "the result" 
into the script, but it was very un-enlightening. I also alternated 
using "revGoURL" with the same URL, and bingo, the patent showed up 
in Netscape.  So there were no issues with the EPO server at the 
times I was trying.

With that introduction, the "Result #1" (see below) shows the single 
word "error". Not very enlightening! I am using the following 
handler, if anyone wishes to try it:

on mouseUp
   libUrlSetSSLVerification false
   put 
"https://publications.european-patent-office.org/PublicationServer/getpdf.jsp?cc=EP&pn=1502502&ki=A1" 
into theURL
   put URL theURL into holdData
   put the result into theRes
   if theRes <> empty then
     answer "Result #1: " & theRes
   else
     put holdData into URL "binfile:1502503.pdf"
     put the result into theRes2
     if theRes2 <> empty then
       answer "Result #2: " & theRes2
     end if
   end if
end mouseUp

Again, if you substitute "revgourl theURL" in the appropriate place, 
you will have the patent showing up in your browser in no time 
(figuratively speaking, of course). Any hints for this problem would 
be appreciated!

Regards,

Bruce Pokras


More information about the use-livecode mailing list