Sample code for 30+ languages & platforms
Visual Basic 6.0

Example: Http.DownloadSb method

See more HTTP Examples

Demonstrates the DownloadSb method.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim http As New ChilkatHttp
http.KeepResponseBody = 1

Dim sb As New ChilkatStringBuilder
success = http.DownloadSb("https://chilkatsoft.com/testData/helloWorld.txt","utf-8",sb)

Dim statusCode As Long
statusCode = http.LastStatus
If (success = 0) Then
    If (statusCode = 0) Then
        ' Unable to either send the request or get the response.
        Debug.Print http.LastErrorText
    Else
        ' We got a response, but the status code was not in the 200s
        Debug.Print "Response status code: " & statusCode
        ' Examine the response body.
        Debug.Print "Response body:"
        Debug.Print http.LastResponseBody
    End If

    Debug.Print "Download failed."

Else
    Debug.Print "Download success, response status = " & statusCode
    Debug.Print sb.GetAsString()
End If