Unicode C++
Unicode C++
Example: Http.HttpNoBody method
Demonstrates how to use the HttpNoBody method to send HTTP requests without a request body (e.g., GET, DELETE, HEAD) and receive the response in a Chilkat Http response object.Chilkat Unicode C++ Downloads
#include <CkHttpW.h>
#include <CkHttpResponseW.h>
void ChilkatSample(void)
{
bool success = false;
CkHttpW http;
CkHttpResponseW resp;
// Send a DELETE request to https://api.example.com/users/123
const wchar_t *url = L"https://api.example.com/users/123";
success = http.HttpNoBody(L"DELETE",url,resp);
if (success == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
wprintf(L"Response Status Code: %d\n",resp.get_StatusCode());
wprintf(L"Response body:\n");
wprintf(L"%s\n",resp.bodyStr());
}