![]() |
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
(Unicode C) Inspect HTTP Request HeaderDemonstrates the
#include <C_CkHttpW.h> #include <C_CkHttpResponseW.h> void ChilkatSample(void) { BOOL success; HCkHttpW http; const wchar_t *url; const wchar_t *json; HCkHttpResponseW resp; success = FALSE; http = CkHttpW_Create(); url = L"https://chilkatsoft.com/echo_request_body.asp"; json = L"{\"greeting\":\"Hello World\"}"; // Send a POST with the JSON in the HTTP request body. resp = CkHttpResponseW_Create(); success = CkHttpW_HttpStr(http,L"POST",url,json,L"utf-8",L"application/json",resp); if (success == FALSE) { wprintf(L"%s\n",CkHttpW_lastErrorText(http)); CkHttpW_Dispose(http); CkHttpResponseW_Dispose(resp); return; } // Examine the HTTP request header we just sent. wprintf(L"%s\n",CkHttpW_lastHeader(http)); // Output: // POST /echo_request_body.asp HTTP/1.1 // Host: chilkatsoft.com // Accept: */* // Accept-Encoding: gzip // Content-Type: application/json // Content-Length: 26 CkHttpW_Dispose(http); CkHttpResponseW_Dispose(resp); } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.