Perl
Chilkat2 Perl
Load XML from a Remote URL
Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xmlChilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
# This example assumes the Chilkat HTTP API to have been previously unlocked.
# See Global Unlock Sample for sample code.
my $http = Chilkat2::Http->new;
my $sbXml = Chilkat2::StringBuilder->new;
# Download the XML from the URL into sbXml
my $success = $http->QuickGetSb('https://www.chilkatsoft.com/hamlet.xml', $sbXml);
if (!$success) {
print $http->LastErrorText, "\n";
exit;
}
my $xml = Chilkat2::Xml->new;
# Load the XML contained in sbXml
$success = $xml->LoadSb($sbXml, 1);
if (!$success) {
print $xml->LastErrorText, "\n";
exit;
}
print "Success.\n";