AutoIt Requires Chilkat v11.0.0+
AutoIt
Example: Http.HttpBinary method
Demonstrates theHttpBinary method.
Chilkat AutoIt Downloads
Local $bSuccess = False
Local $sLocalFilePath = "C:/example/zips/data.zip"
$oBd = ObjCreate("Chilkat.BinData")
$bSuccess = $oBd.LoadFile($sLocalFilePath)
If ($bSuccess = False) Then
ConsoleWrite($oBd.LastErrorText & @CRLF)
Exit
EndIf
Local $oZipBytes
$oZipBytes = $oBd.GetData()
Local $sUrl = "https://example.com/api/v1/sites/123/deploys"
; Send a POST with a binary HTTP request body.
$oResp = ObjCreate("Chilkat.HttpResponse")
$oHttp = ObjCreate("Chilkat.Http")
$bSuccess = $oHttp.HttpBinary("POST",$sUrl,$oZipBytes,"application/zip",$oResp)
If ($bSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Response Status Code: " & $oResp.StatusCode & @CRLF)
ConsoleWrite("Response body:" & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)