如何从同步 roUrlTransfer 调用中获取错误代码
How do you get error code from syncronous roUrlTransfer call
我有这段代码可以从 HTTPS url:
获取并解析 JSON
Function GetJson(sUrl As String) As dynamic
if sUrl = invalid return invalid
httpGet = CreateObject("roUrlTransfer")
httpGet.SetURL(sUrl)
httpGet.EnableEncodings(true)
httpGet.RetainBodyOnError(true)
sData = httpGet.GetToString()
if sData = ""
print "ERROR: " + sUrl + " : " + httpGet.GetFailureReason()
end if
data = ParseJson(sData)
return data
End Function
s数据为空。如何获取 HTTP 响应代码或错误? httpGet.GetFailureReason()
总是空白...
原来修复是添加这个,但我需要找出如何转储 HTTP(s) 错误以便我知道发生了什么
httpGet.SetCertificatesFile("common:/certs/ca-bundle.crt")
httpGet.InitClientCertificates()
有什么想法吗?
检查 getToString 的文档。您无法通过同步调用获得响应代码。请改用 asyncGetToString。
我有这段代码可以从 HTTPS url:
获取并解析 JSONFunction GetJson(sUrl As String) As dynamic
if sUrl = invalid return invalid
httpGet = CreateObject("roUrlTransfer")
httpGet.SetURL(sUrl)
httpGet.EnableEncodings(true)
httpGet.RetainBodyOnError(true)
sData = httpGet.GetToString()
if sData = ""
print "ERROR: " + sUrl + " : " + httpGet.GetFailureReason()
end if
data = ParseJson(sData)
return data
End Function
s数据为空。如何获取 HTTP 响应代码或错误? httpGet.GetFailureReason()
总是空白...
原来修复是添加这个,但我需要找出如何转储 HTTP(s) 错误以便我知道发生了什么
httpGet.SetCertificatesFile("common:/certs/ca-bundle.crt")
httpGet.InitClientCertificates()
有什么想法吗?
检查 getToString 的文档。您无法通过同步调用获得响应代码。请改用 asyncGetToString。