Sample code for 30+ languages & platforms
C++

Transition from Http.PBinaryBd to Http.HttpBd

Provides instructions for replacing deprecated PBinaryBd method calls with HttpBd.

Chilkat C++ Downloads

C++
#include <CkHttp.h>
#include <CkBinData.h>
#include <CkHttpResponse.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkHttp http;

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

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

    CkHttpResponse *responseObj = http.PBinaryBd(verb,url,bdRequestBody,contentType,false,false);
    if (http.get_LastMethodSuccess() == false) {
        std::cout << http.lastErrorText() << "\r\n";
        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.

    CkHttpResponse responseOut;
    success = http.HttpBd(verb,url,bdRequestBody,contentType,responseOut);
    if (success == false) {
        std::cout << http.lastErrorText() << "\r\n";
        return;
    }
    }