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

Example: Http.HttpNoBody method

Demonstrates how to use the HttpNoBody method to send HTTP requests without a request body (e.g., GET, DELETE, HEAD) and receive the response in a Chilkat Http response object.

Chilkat Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
http: HCkHttp;
resp: HCkHttpResponse;
url: PWideChar;

begin
success := False;

http := CkHttp_Create();
resp := CkHttpResponse_Create();

//  Send a DELETE request to https://api.example.com/users/123
url := 'https://api.example.com/users/123';
success := CkHttp_HttpNoBody(http,'DELETE',url,resp);
if (success = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

Memo1.Lines.Add('Response Status Code: ' + IntToStr(CkHttpResponse_getStatusCode(resp)));
Memo1.Lines.Add('Response body:');
Memo1.Lines.Add(CkHttpResponse__bodyStr(resp));

CkHttp_Dispose(http);
CkHttpResponse_Dispose(resp);