Perl
Chilkat2 Perl
Example: Http.QuickGetSb method
Demonstrates theQuickGetSb method.
Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
my $http = Chilkat2::Http->new;
# Send the HTTP GET and return the content in a StringBuilder
my $sb = Chilkat2::StringBuilder->new;
my $success = $http->QuickGetSb('https://www.chilkatsoft.com/helloWorld.json', $sb);
if (!$http->LastMethodSuccess) {
if ($http->LastStatus == 0) {
# Communications error. We did not get a response.
print $http->LastErrorText, "\n";
} else {
print 'Response status code: ', $http->LastStatus, "\n";
print "Response body error text:\n";
print $sb->GetAsString(), "\n";
}
exit;
}
# The downloaded content:
print $sb->GetAsString(), "\n";
print "Success\n";