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