![]() |
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
(C) Example: Http.DownloadSb methodSee more HTTP ExamplesDemonstrates theDownloadSb method.
#include <C_CkHttp.h> #include <C_CkStringBuilder.h> void ChilkatSample(void) { BOOL success; HCkHttp http; HCkStringBuilder sb; int statusCode; success = FALSE; http = CkHttp_Create(); CkHttp_putKeepResponseBody(http,TRUE); sb = CkStringBuilder_Create(); success = CkHttp_DownloadSb(http,"https://chilkatsoft.com/testData/helloWorld.txt","utf-8",sb); statusCode = CkHttp_getLastStatus(http); if (success == FALSE) { if (statusCode == 0) { // Unable to either send the request or get the response. printf("%s\n",CkHttp_lastErrorText(http)); } else { // We got a response, but the status code was not in the 200s printf("Response status code: %d\n",statusCode); // Examine the response body. printf("Response body:\n"); printf("%s\n",CkHttp_lastResponseBody(http)); } printf("Download failed.\n"); } else { printf("Download success, response status = %d\n",statusCode); printf("%s\n",CkStringBuilder_getAsString(sb)); } CkHttp_Dispose(http); CkStringBuilder_Dispose(sb); } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.