(VB.NET) Example: Http.HttpBinary method
Demonstrates the HttpBinary method. Note: This example requires Chilkat v11.0.0 or greater.
Dim success As Boolean = False
Dim localFilePath As String = "C:/example/zips/data.zip"
Dim bd As New Chilkat.BinData
success = bd.LoadFile(localFilePath)
If (success = False) Then
Debug.WriteLine(bd.LastErrorText)
Exit Sub
End If
Dim zipBytes() As Byte
zipBytes = bd.GetData()
Dim url As String = "https://example.com/api/v1/sites/123/deploys"
' Send a POST with a binary HTTP request body.
Dim resp As New Chilkat.HttpResponse
Dim http As New Chilkat.Http
success = http.HttpBinary("POST",url,zipBytes,"application/zip",resp)
If (success = False) Then
Debug.WriteLine(http.LastErrorText)
Exit Sub
End If
Debug.WriteLine("Response Status Code: " & resp.StatusCode)
Debug.WriteLine("Response body:")
Debug.WriteLine(resp.BodyStr)
|