Sample code for 30+ languages & platforms
Delphi DLL Requires Chilkat v11.0.0+

Transition from Http.PBinaryBd to Http.HttpBd

Provides instructions for replacing deprecated PBinaryBd method calls with HttpBd.

Chilkat Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
http: HCkHttp;
verb: PWideChar;
url: PWideChar;
bdRequestBody: HCkBinData;
contentType: PWideChar;
responseObj: HCkHttpResponse;
responseOut: HCkHttpResponse;

begin
success := False;

http := CkHttp_Create();

verb := 'POST';
url := 'https://example.com/';
bdRequestBody := CkBinData_Create();
contentType := 'application/octet-stream';

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

responseObj := CkHttp_PBinaryBd(http,verb,url,bdRequestBody,contentType,False,False);
if (CkHttp_getLastMethodSuccess(http) = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

//  ...
//  ...

CkHttpResponse_Dispose(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.

responseOut := CkHttpResponse_Create();
success := CkHttp_HttpBd(http,verb,url,bdRequestBody,contentType,responseOut);
if (success = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

CkHttp_Dispose(http);
CkBinData_Dispose(bdRequestBody);
CkHttpResponse_Dispose(responseOut);