(AutoIt) 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.
$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess
$oFac = ObjCreate("Chilkat_9_5_0.FileAccess")
Local $oReqBody
$oReqBody = $oFac.ReadEntireFile("qa_data/pdf/helloWorld.pdf")
Local $sResponseStr = $oHttp.PostBinary("https://example.com/something",$oReqBody,"application/pdf",False,False)
If ($oHttp.LastMethodSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
Local $iResponseStatusCode = $oHttp.LastStatus
ConsoleWrite("Status code: " & $iResponseStatusCode & @CRLF)
; For example, if the response is XML, JSON, HTML, etc.
ConsoleWrite("response body:" & @CRLF)
ConsoleWrite($sResponseStr & @CRLF)
|