Hey, I made a recursive function to do that and it seems to work fine. Here is the code I used :
'*****************************************************************************************
' GetContent
'*****************************************************************************************
sub GetContent()
' request the content feed from the API
xfer = CreateObject("roURLTransfer")
xfer.SetCertificatesFile("common:/certs/ca-bundle.crt")
xfer.InitClientCertificates()
port = CreateObject("roMessagePort")
xfer.SetMessagePort(port)
xfer.SetURL("https://myvalidurl.com/page?parameter=sample")
data = TryToGetData(xfer, port, 5)
if data <> invalid and data <> ""
ProcessContent(data)
else
m.top.error++
end if
end sub
'*****************************************************************************************
' TryToGetData
'*****************************************************************************************
function TryToGetData(xfer, port, numberOfTries)
if numberOfTries < 0
return invalid
end if
if xfer.AsyncGetToString()
rsp = wait(10000, port)
print type(rsp)
if type(rsp) = "roUrlEvent"
code = rsp.GetResponseCode()
print "Response code is " code
if code <> 200
print "Re-trying to load content"
triesRemaining = numberOfTries - 1
return TryToGetData(xfer, port, triesRemaining)
else
print "Content retrieved correctly"
return rsp.GetString()
end if
end if
end if
' Should never get here
return invalid
end function