Sample code for 30+ languages & platforms
Lianja

Example: Http.DownloadSb method

See more HTTP Examples

Demonstrates the DownloadSb method.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

loHttp = createobject("CkHttp")
loHttp.KeepResponseBody = .T.

loSb = createobject("CkStringBuilder")
llSuccess = loHttp.DownloadSb("https://chilkatsoft.com/testData/helloWorld.txt","utf-8",loSb)

lnStatusCode = loHttp.LastStatus
if (llSuccess = .F.) then
    if (lnStatusCode = 0) then
        // Unable to either send the request or get the response.
        ? loHttp.LastErrorText
    else
        // We got a response, but the status code was not in the 200s
        ? "Response status code: " + str(lnStatusCode)
        // Examine the response body.
        ? "Response body:"
        ? loHttp.LastResponseBody
    endif

    ? "Download failed."

else
    ? "Download success, response status = " + str(lnStatusCode)
    ? loSb.GetAsString()
endif



release loHttp
release loSb