Sample code for 30+ languages & platforms
Unicode C++

Transition from Http.PBinaryBd to Http.HttpBd

Provides instructions for replacing deprecated PBinaryBd method calls with HttpBd.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkHttpW.h>
#include <CkBinDataW.h>
#include <CkHttpResponseW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkHttpW http;

    const wchar_t *verb = L"POST";
    const wchar_t *url = L"https://example.com/";
    CkBinDataW bdRequestBody;
    const wchar_t *contentType = L"application/octet-stream";

    //  ------------------------------------------------------------------------
    //  The PBinaryBd method is deprecated:

    CkHttpResponseW *responseObj = http.PBinaryBd(verb,url,bdRequestBody,contentType,false,false);
    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }

    //  ...
    //  ...

    delete responseObj;

    //  ------------------------------------------------------------------------
    //  Do the equivalent using HttpBd.
    //  Your application creates a new, empty HttpResponse object which is passed 
    //  in the last argument and filled upon success.

    CkHttpResponseW responseOut;
    success = http.HttpBd(verb,url,bdRequestBody,contentType,responseOut);
    if (success == false) {
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }
    }