West Wind Internet and Client Tools
Resubmitting a failed HTTPGet
If a HTTPGet returns an error because of something downstream I would like to retry it once. Can I just re-submit the HTTPGet like below or do I need to do the addpostkeys again?
Thanks!!
loHTTP = createobject([wwHTTP])
loHTTP.nConnectTimeout = 30
loHTTP.nHTTPConnectType = 0
loHttp.AddPostKey([secret] ,xSecret)
loHttp.AddPostKey([response] ,xResp)
loHttp.AddPostKey([remoteip] ,xIP)
cResult = loHTTP.HTTPGet([https://www.google.com/recaptcha/api/siteverify])
if loHttp.nError <> 0
if lohttp.cerrormsg = [The server returned an invalid or unrecognized response]
cResult= loHTTP.HTTPGet([https://www.google.com/recaptcha/api/siteverify])
endif
endif
It's recommended that you create a new instance of wwHttp for each request you make to ensure that you are running a completely clean instance.
The POST buffer is cleaned out when the request completes so no the data is not stored.
Should be easy enough to create a method that creates the HTTP request or runs the request in a self-contained reusable fashion.
+++ Rick ---