Getting the contents of a web request using load url

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 454
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Getting the contents of a web request using load url

Post by andyh1234 » Sun Oct 27, 2024 1:34 pm

Hi,

Im looking to use load url instead of get to save long pauses in my app.

I have the code

Code: Select all

on validateAPI
  put "https://www.sample.com/v1/accounts/" into tURL
  load url tUrl with message "validationLoaded"
end validateAPI

on validationLoaded pURL, pURLStatus
   if pURLStatus is "cached" then
      ## LiveCode has cached URL content. Accessing the url uses
      ## the cache. 
      answer  "Result" && pURL
      		
      ## Remove URL from cache if you are all done with it.
      unload url pURL
   else
      put libURLErrorData(pURL) into tError
     answer "Error" && tError
   end if
   
end validationLoaded
what do I have to add to get the page data? I can see the URL that has been called and its status (cached or error) fine, but I don't know what to do to get the actual page data and cant find any examples anywhere.

Thanks

Post Reply

Return to “Internet”