PHP Extension
PHP Extension
Example: Http.QuickGetStr method
Demonstrates theQuickGetStr method.
Chilkat PHP Extension Downloads
<?php
include("chilkat.php");
$http = new CkHttp();
// Keep the response body if there's an error.
$http->put_KeepResponseBody(true);
// Send the HTTP GET and return the content in a string.
$str = $http->quickGetStr('https://www.chilkatsoft.com/helloWorld.json');
if ($http->get_LastMethodSuccess() == false) {
if ($http->get_LastStatus() == 0) {
// Communications error. We did not get a response.
print $http->lastErrorText() . "\n";
}
else {
print 'Response status code: ' . $http->get_LastStatus() . "\n";
print 'Response body error text:' . "\n";
print $http->lastResponseBody() . "\n";
}
exit;
}
print $str . "\n";
print 'Success' . "\n";
?>