(PowerBuilder) Example: Http.QuickGetStr method
Demonstrates the QuickGetStr method.
integer li_rc
oleobject loo_Http
string ls_Str
loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Keep the response body if there's an error.
loo_Http.KeepResponseBody = 1
// Send the HTTP GET and return the content in a string.
ls_Str = loo_Http.QuickGetStr("https://www.chilkatsoft.com/helloWorld.json")
if loo_Http.LastMethodSuccess = 0 then
if loo_Http.LastStatus = 0 then
// Communications error. We did not get a response.
Write-Debug loo_Http.LastErrorText
else
Write-Debug "Response status code: " + string(loo_Http.LastStatus)
Write-Debug "Response body error text:"
Write-Debug loo_Http.LastResponseBody
end if
destroy loo_Http
return
end if
Write-Debug ls_Str
Write-Debug "Success"
destroy loo_Http
|