Sample code for 30+ languages & platforms
PowerBuilder

Setting a HTTP Max Response Size

Demonstrates the MaxResponseSize property.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Http
integer li_MaxSz
string ls_XmlStr

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

li_MaxSz = 16384
loo_Http.MaxResponseSize = li_MaxSz

// Try to get something larger, such as hamlet.xml which is 279658 bytes
ls_XmlStr = loo_Http.QuickGetStr("https://chilkatsoft.com/hamlet.xml")
if loo_Http.LastMethodSuccess = 0 then
    // If the LastErrorText contains the string "MaxResponseSize",
    // then the HTTP request failed because the response body would've been larger than the max allowed response size.
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    return
end if

Write-Debug "OK"


destroy loo_Http