Xojo Plugin
Xojo Plugin
HTTP POST with Binary Data in Request Body
See more HTTP Examples
Do an HTTPS POST with a binary request body.Chilkat Xojo Plugin Downloads
Dim success As Boolean
success = 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 MemoryBlock
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
System.DebugLog(http.LastErrorText)
Return
End If
Dim responseStatusCode As Int32
responseStatusCode = resp.StatusCode
System.DebugLog("Status code: " + Str(responseStatusCode))
// For example, if the response is XML, JSON, HTML, etc.
System.DebugLog("response body:")
System.DebugLog(resp.BodyStr)