(PHP Extension) Load XML from a Remote URL
Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xml
<?php
include("chilkat.php");
// Use "chilkat_9_5_0.php" for versions of Chilkat < 10.0.0
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
$http = new CkHttp();
$sbXml = new CkStringBuilder();
// Download the XML from the URL into sbXml
$success = $http->QuickGetSb('https://www.chilkatsoft.com/hamlet.xml',$sbXml);
if ($success == false) {
print $http->lastErrorText() . "\n";
exit;
}
$xml = new CkXml();
// Load the XML contained in sbXml
$success = $xml->LoadSb($sbXml,true);
if ($success == false) {
print $xml->lastErrorText() . "\n";
exit;
}
print 'Success.' . "\n";
?>
|