Checking Server Results If Return is HTML

Dan Shafer revdan at danshafer.com
Fri Dec 19 20:27:10 EST 2003


I have an app that sends an HTTP request to a server that returns 
either a non-negative number if the request succeeds or an HTML 
formatted error page if it fails.

In my Rev script, I do:

   put URL tURL into serverReturn
   if char 1 of serverReturn = 1 then
     put "User successfully created" into field serverReturn
   else
     put "Error encountered but no error checking implemented yet." into 
field serverReturn
   end if

(tURL is the URL to which I'm sending the request, just in case that's 
not clear)

If the outcome is successful, the server in this case returns a value 
of 1. This works in my code. But if an error is created, I never get 
the second display. Instead, the debugger tells me "Chunk: No Such 
Object" and the hint has the first two HTML tags of the return value.

Also, FWIW, most of the time when this happens, my Rev app in the Rev 
IDE becomes completely non-responsive and I have to quit Revolution. 
The app will save, so I haven't lost anything yet but this is really 
scary stuff.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dan Shafer, Revolutionary
Author of  "Revolution: Software at the Speed of Thought"
http://www.revolutionpros.com for more info
Available at Runtime Revolution Store (http://www.runrev.com/RevPress)



More information about the use-livecode mailing list