(PHP ActiveX) Load XML from a Remote URL
Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xml
<?php
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.Http')
$http = new COM("Chilkat.Http");
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.StringBuilder')
$sbXml = new COM("Chilkat.StringBuilder");
// Download the XML from the URL into sbXml
$success = $http->QuickGetSb('https://www.chilkatsoft.com/hamlet.xml',$sbXml);
if ($success == 0) {
print $http->LastErrorText . "\n";
exit;
}
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.Xml')
$xml = new COM("Chilkat.Xml");
// Load the XML contained in sbXml
$success = $xml->LoadSb($sbXml,1);
if ($success == 0) {
print $xml->LastErrorText . "\n";
exit;
}
print 'Success.' . "\n";
?>
|