(Xojo Plugin) 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 MemoryBlock
reqBody = fac.ReadEntireFile("qa_data/pdf/helloWorld.pdf")
Dim responseStr As String
responseStr = http.PostBinary("https://example.com/something",reqBody,"application/pdf",False,False)
If (http.LastMethodSuccess = False) Then
System.DebugLog(http.LastErrorText)
Return
End If
Dim responseStatusCode As Int32
responseStatusCode = http.LastStatus
System.DebugLog("Status code: " + Str(responseStatusCode))
// For example, if the response is XML, JSON, HTML, etc.
System.DebugLog("response body:")
System.DebugLog(responseStr)
|