Unicode C++
Unicode C++
Example: Http.QuickGetStr method
Demonstrates theQuickGetStr method.
Chilkat Unicode C++ Downloads
#include <CkHttpW.h>
void ChilkatSample(void)
{
CkHttpW http;
// Keep the response body if there's an error.
http.put_KeepResponseBody(true);
// Send the HTTP GET and return the content in a string.
const wchar_t *str = http.quickGetStr(L"https://www.chilkatsoft.com/helloWorld.json");
if (http.get_LastMethodSuccess() == false) {
if (http.get_LastStatus() == 0) {
// Communications error. We did not get a response.
wprintf(L"%s\n",http.lastErrorText());
}
else {
wprintf(L"Response status code: %d\n",http.get_LastStatus());
wprintf(L"Response body error text:\n");
wprintf(L"%s\n",http.lastResponseBody());
}
return;
}
wprintf(L"%s\n",str);
wprintf(L"Success\n");
}