Sample code for 30+ languages & platforms
AutoIt

Example: Http.DownloadAppend method

Demonstrates the DownloadAppend method.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

Local $sTargetPath = "c:/temp/qa_output/download.txt"

$oHttp = ObjCreate("Chilkat.Http")
$oHttp.KeepResponseBody = True

;  Assume the target file in the local filesystem does not yet exist.
$bSuccess = $oHttp.DownloadAppend("https://chilkatsoft.com/testData/helloWorld.txt",$sTargetPath)
Local $iStatusCode = $oHttp.LastStatus
If ($iStatusCode = 0) Then
    ;  Unable to either send the request or get the response.
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

;  Should be 200.
ConsoleWrite("Response status code: " & $iStatusCode & @CRLF)

;  Examine the contents of the file.
$oSb = ObjCreate("Chilkat.StringBuilder")
$oSb.LoadFile($sTargetPath,"utf-8")
ConsoleWrite($oSb.GetAsString() & @CRLF)

;  Output: 
;  Response status code: 200
;  Hello World!

;  Download another text file and append to the target file.
$bSuccess = $oHttp.DownloadAppend("https://chilkatsoft.com/testData/this_is_a_test.txt",$sTargetPath)
$iStatusCode = $oHttp.LastStatus
If ($iStatusCode = 0) Then
    ;  Unable to either send the request or get the response.
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

;  Should be 200.
ConsoleWrite("Response status code: " & $iStatusCode & @CRLF)

;  Examine the contents of the file.
$oSb.LoadFile($sTargetPath,"utf-8")
ConsoleWrite($oSb.GetAsString() & @CRLF)

;  Output:
;  Response status code: 200
;  Hello World!This is a Test.

;  Delete the local target file.
$oFac = ObjCreate("Chilkat.FileAccess")
$oFac.FileDelete($sTargetPath)

;  Try to download a file that does not exist:
$bSuccess = $oHttp.DownloadAppend("https://chilkatsoft.com/testData/does_not_exist.txt",$sTargetPath)
$iStatusCode = $oHttp.LastStatus
If ($iStatusCode = 0) Then
    ;  Unable to either send the request or get the response.
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
Else
    ;  We got a response, and we already know it wasn't a 200 success response.
    ;  It should be a 404 not found.
    ConsoleWrite("Response status code: " & $iStatusCode & @CRLF)
    ;  Examine the response body.
    ConsoleWrite("Response body:" & @CRLF)
    ConsoleWrite($oHttp.LastResponseBody & @CRLF)
EndIf