VB.NET
VB.NET
HTTP POST with Binary Data in Request Body
See more HTTP Examples
Do an HTTPS POST with a binary request body.Chilkat VB.NET Downloads
Dim success As Boolean = False
' 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 fac As New Chilkat.FileAccess
Dim reqBody() As Byte
reqBody = fac.ReadEntireFile("qa_data/pdf/helloWorld.pdf")
Dim resp As New Chilkat.HttpResponse
success = http.HttpBinary("POST","https://example.com/something",reqBody,"application/pdf",resp)
If (success = False) Then
Debug.WriteLine(http.LastErrorText)
Exit Sub
End If
Dim responseStatusCode As Integer = resp.StatusCode
Debug.WriteLine("Status code: " & responseStatusCode)
' For example, if the response is XML, JSON, HTML, etc.
Debug.WriteLine("response body:")
Debug.WriteLine(resp.BodyStr)