PHP
Chilkat2 PHP
Example: Http.QuickGetSb method
Demonstrates theQuickGetSb method.
Chilkat PHP Downloads
<?php
use Chilkat2\Http;
use Chilkat2\StringBuilder;
$http = new Http();
// Send the HTTP GET and return the content in a StringBuilder
$sb = new StringBuilder();
try {
$http->QuickGetSb('https://www.chilkatsoft.com/helloWorld.json', $sb);
} catch (\Chilkat2\Exception $e) {
if ($http->LastStatus == 0) {
// Communications error. We did not get a response.
echo $e->getMessage(), "\n";
} else {
echo 'Response status code: ', $http->LastStatus, "\n";
echo "Response body error text:\n";
echo $sb->GetAsString(), "\n";
}
exit;
}
// The downloaded content:
echo $sb->GetAsString(), "\n";
echo "Success\n";