(Visual Basic 6.0) HTTP POST with Binary Data in Request Body
Do an HTTPS POST with a binary request body.
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim http As New ChilkatHttp
Dim success As Long
Dim fac As New CkFileAccess
Dim reqBody() As Byte
reqBody = fac.ReadEntireFile("qa_data/pdf/helloWorld.pdf")
Dim responseStr As String
responseStr = http.PostBinary("https://example.com/something",reqBody,"application/pdf",0,0)
If (http.LastMethodSuccess = 0) Then
Debug.Print http.LastErrorText
Exit Sub
End If
Dim responseStatusCode As Long
responseStatusCode = http.LastStatus
Debug.Print "Status code: " & responseStatusCode
' For example, if the response is XML, JSON, HTML, etc.
Debug.Print "response body:"
Debug.Print responseStr
|