(PHP ActiveX) 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. Note: This example requires Chilkat v11.0.0 or greater.
<?php
$success = 0;
$http = new COM("Chilkat.Http");
$resp = new COM("Chilkat.HttpResponse");
// Send a DELETE request to https://api.example.com/users/123
$url = 'https://api.example.com/users/123';
$success = $http->HttpNoBody('DELETE',$url,$resp);
if ($success == 0) {
print $http->LastErrorText . "\n";
exit;
}
print 'Response Status Code: ' . $resp->StatusCode . "\n";
print 'Response body:' . "\n";
print $resp->BodyStr . "\n";
?>
|