Unicode C++
Unicode C++
Transition from Http.PText to Http.HttpStr
Provides instructions for replacing deprecated PText method calls with HttpStr.Chilkat Unicode C++ Downloads
#include <CkHttpW.h>
#include <CkHttpResponseW.h>
void ChilkatSample(void)
{
bool success = false;
CkHttpW http;
const wchar_t *verb = L"PUT";
const wchar_t *url = L"https://example.com/";
const wchar_t *textData = L"This is the HTTP request body";
const wchar_t *charset = L"utf-8";
const wchar_t *contentType = L"text/plain";
// ------------------------------------------------------------------------
// The PText method is deprecated:
CkHttpResponseW *responseObj = http.PText(verb,url,textData,charset,contentType,false,false);
if (http.get_LastMethodSuccess() == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
// ...
// ...
delete responseObj;
// ------------------------------------------------------------------------
// Do the equivalent using HttpStr.
// Your application creates a new, empty HttpResponse object which is passed
// in the last argument and filled upon success.
CkHttpResponseW responseOut;
success = http.HttpStr(verb,url,textData,charset,contentType,responseOut);
if (success == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
}