Speeding up get URL

Shari shari at gypsyware.com
Sun Aug 3 12:20:22 EDT 2008


>I wonder if using "load" URL might be faster?
>
>sims

I haven't tried it.  The docs made it seem like the wrong choice as 
the url must be fully loaded for the handler to continue.  I check 
this by looking for </html> in the fetched url.

According to the docs "load" downloads the url in the background and 
doesn't wait for the complete download before continuing the script.

I'm not sure how to counter this.  Would you create an array to hold 
the url address and contents?  Each address being a key, and each 
contents being the contents of the page?  And then run the parsing 
handler on the array?

So that while it's parsing this url, in the background it's still 
loading other urls into the array?



>>  From the docs:
The load command is non-blocking, so it does not stop the current 
handler while the download is completed. The handler continues while 
the load command downloads the URL in the background. You can monitor 
the download by checking the URLStatus function periodically.

   Caution!  Avoid using the wait command in a handler after executing 
the load command. Since the load command is non-blocking, it may 
still be running when your handler reaches the wait command. And 
since the load command is part of the Internet library and is 
implemented in a handler, the wait command will stop the download 
process if it is executed while the download is still going on. In 
particular, do not use constructions like the following, which will 
sit forever without downloading the file:

   load URL myURL
   wait until the URLStatus of myURL is "cached" -- DON'T DO THIS

The file is downloaded into a local cache. It does not remain 
available after the application quits; the purpose of the cache is to 
speed up access to the specified URL, not to store it permanently. 
You can use a URL even if it is not in the cache, so use of the load 
command is optional.
<<

>>
All actions that refer to a URL container are blocking: that is, the 
handler pauses until Revolution is finished accessing the URL. Since 
fetching a web page may take some time due to network lag, accessing 
URLs may take long enough to be noticeable to the user. To avoid this 
delay, use the load command (which is non-blocking) to cache web 
pages before you need them.
<<


-- 
   Dogs and bears, sports and cars, and patriots t-shirts
   http://www.villagetshirts.com
  WlND0WS and MAClNT0SH shareware games
  http://www.gypsyware.com



More information about the use-livecode mailing list