Sample code for 30+ languages & platforms
Objective-C 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 Objective-C Downloads

Objective-C
#import <CkoHttp.h>
#import <CkoHttpResponse.h>
#import <NSString.h>

BOOL success = NO;

CkoHttp *http = [[CkoHttp alloc] init];
CkoHttpResponse *resp = [[CkoHttpResponse alloc] init];

//  Send a DELETE request to https://api.example.com/users/123
NSString *url = @"https://api.example.com/users/123";
success = [http HttpNoBody: @"DELETE" url: url response: resp];
if (success == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

NSLog(@"%@%d",@"Response Status Code: ",[resp.StatusCode intValue]);
NSLog(@"%@",@"Response body:");
NSLog(@"%@",resp.BodyStr);