Sample code for 30+ languages & platforms
Perl

Load XML from a Remote URL

Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xml

Chilkat Perl Downloads

Perl
use chilkat();

$success = 0;

# This example assumes the Chilkat HTTP API to have been previously unlocked.
# See Global Unlock Sample for sample code.

$http = chilkat::CkHttp->new();
$sbXml = chilkat::CkStringBuilder->new();

# Download the XML from the URL into sbXml
$success = $http->QuickGetSb("https://www.chilkatsoft.com/hamlet.xml",$sbXml);
if ($success == 0) {
    print $http->lastErrorText() . "\r\n";
    exit;
}

$xml = chilkat::CkXml->new();

# Load the XML contained in sbXml
$success = $xml->LoadSb($sbXml,1);
if ($success == 0) {
    print $xml->lastErrorText() . "\r\n";
    exit;
}

print "Success." . "\r\n";