Perl Requires Chilkat v11.0.0+
Chilkat2 Perl
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 Perl Downloads
use strict;
use warnings;
use Chilkat2;
my $http = Chilkat2::Http->new;
my $resp = Chilkat2::HttpResponse->new;
# Send a DELETE request to https://api.example.com/users/123
my $url = 'https://api.example.com/users/123';
my $success = $http->HttpNoBody('DELETE', $url, $resp);
if (!$success) {
print $http->LastErrorText, "\n";
exit;
}
print 'Response Status Code: ', $resp->StatusCode, "\n";
print "Response body:\n";
print $resp->BodyStr, "\n";