![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Xojo Plugin) Example: Http.DownloadAppend methodDemonstrates the DownloadAppend method.
Dim success As Boolean success = False success = False Dim targetPath As String targetPath = "c:/temp/qa_output/download.txt" Dim http As New Chilkat.Http http.KeepResponseBody = True // Assume the target file in the local filesystem does not yet exist. success = http.DownloadAppend("https://chilkatsoft.com/testData/helloWorld.txt",targetPath) Dim statusCode As Int32 statusCode = http.LastStatus If (statusCode = 0) Then // Unable to either send the request or get the response. System.DebugLog(http.LastErrorText) Return End If // Should be 200. System.DebugLog("Response status code: " + Str(statusCode)) // Examine the contents of the file. Dim sb As New Chilkat.StringBuilder success = sb.LoadFile(targetPath,"utf-8") System.DebugLog(sb.GetAsString()) // Output: // Response status code: 200 // Hello World! // Download another text file and append to the target file. success = http.DownloadAppend("https://chilkatsoft.com/testData/this_is_a_test.txt",targetPath) statusCode = http.LastStatus If (statusCode = 0) Then // Unable to either send the request or get the response. System.DebugLog(http.LastErrorText) Return End If // Should be 200. System.DebugLog("Response status code: " + Str(statusCode)) // Examine the contents of the file. success = sb.LoadFile(targetPath,"utf-8") System.DebugLog(sb.GetAsString()) // Output: // Response status code: 200 // Hello World!This is a Test. // Delete the local target file. Dim fac As New Chilkat.FileAccess success = fac.FileDelete(targetPath) // Try to download a file that does not exist: success = http.DownloadAppend("https://chilkatsoft.com/testData/does_not_exist.txt",targetPath) statusCode = http.LastStatus If (statusCode = 0) Then // Unable to either send the request or get the response. System.DebugLog(http.LastErrorText) Else // We got a response, and we already know it wasn't a 200 success response. // It should be a 404 not found. System.DebugLog("Response status code: " + Str(statusCode)) // Examine the response body. System.DebugLog("Response body:") System.DebugLog(http.LastResponseBody) End If |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.