(Tcl) 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.
load ./chilkat.dll
set success 0
set http [new_CkHttp]
set resp [new_CkHttpResponse]
# Send a DELETE request to https://api.example.com/users/123
set url "https://api.example.com/users/123"
set success [CkHttp_HttpNoBody $http "DELETE" $url $resp]
if {$success == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
delete_CkHttpResponse $resp
exit
}
puts "Response Status Code: [CkHttpResponse_get_StatusCode $resp]"
puts "Response body:"
puts [CkHttpResponse_bodyStr $resp]
delete_CkHttp $http
delete_CkHttpResponse $resp
|