(VB.NET) 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 Chilkat.Http
Dim success As Boolean
Dim fac As New Chilkat.FileAccess
Dim reqBody() As Byte
reqBody = fac.ReadEntireFile("qa_data/pdf/helloWorld.pdf")
Dim responseStr As String = http.PostBinary("https://example.com/something",reqBody,"application/pdf",False,False)
If (http.LastMethodSuccess = False) Then
Debug.WriteLine(http.LastErrorText)
Exit Sub
End If
Dim responseStatusCode As Integer = http.LastStatus
Debug.WriteLine("Status code: " & responseStatusCode)
' For example, if the response is XML, JSON, HTML, etc.
Debug.WriteLine("response body:")
Debug.WriteLine(responseStr)
|