(Xojo Plugin) Example: Http.HttpBinary method
Demonstrates the HttpBinary method. Note: This example requires Chilkat v11.0.0 or greater.
Dim success As Boolean
success = False
Dim localFilePath As String
localFilePath = "C:/example/zips/data.zip"
Dim bd As New Chilkat.BinData
success = bd.LoadFile(localFilePath)
If (success = False) Then
System.DebugLog(bd.LastErrorText)
Return
End If
Dim zipBytes As MemoryBlock
zipBytes = bd.GetData()
Dim url As String
url = "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
System.DebugLog(http.LastErrorText)
Return
End If
System.DebugLog("Response Status Code: " + Str(resp.StatusCode))
System.DebugLog("Response body:")
System.DebugLog(resp.BodyStr)
|