PowerBuilder
PowerBuilder
Example: Http.QuickGetSb method
Demonstrates theQuickGetSb method.
Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Http
oleobject loo_Sb
li_Success = 0
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
// Send the HTTP GET and return the content in a StringBuilder
loo_Sb = create oleobject
li_rc = loo_Sb.ConnectToNewObject("Chilkat.StringBuilder")
li_Success = loo_Http.QuickGetSb("https://www.chilkatsoft.com/helloWorld.json",loo_Sb)
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_Sb.GetAsString()
end if
destroy loo_Http
destroy loo_Sb
return
end if
// The downloaded content:
Write-Debug loo_Sb.GetAsString()
Write-Debug "Success"
destroy loo_Http
destroy loo_Sb