C++
C++
Transition from Http.PostXml to Http.HttpStr
Provides instructions for replacing deprecated PostXml method calls with HttpStr.Chilkat C++ Downloads
#include <CkHttp.h>
#include <CkHttpResponse.h>
void ChilkatSample(void)
{
bool success = false;
CkHttp http;
const char *url = "https://example.com/something";
const char *requestBodyXml = "<something>...</something>";
const char *charset = "utf-8";
// ------------------------------------------------------------------------
// The PostXml method is deprecated:
CkHttpResponse *responseObj = http.PostXml(url,requestBodyXml,charset);
if (http.get_LastMethodSuccess() == false) {
std::cout << http.lastErrorText() << "\r\n";
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.
CkHttpResponse responseOut;
success = http.HttpStr("POST",url,requestBodyXml,charset,"application/xml",responseOut);
if (success == false) {
std::cout << http.lastErrorText() << "\r\n";
return;
}
}