(PHP Extension) 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
include("chilkat.php");
$success = false;
$http = new CkHttp();
$resp = new CkHttpResponse();
// 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 == false) {
print $http->lastErrorText() . "\n";
exit;
}
print 'Response Status Code: ' . $resp->get_StatusCode() . "\n";
print 'Response body:' . "\n";
print $resp->bodyStr() . "\n";
?>
|