PHP
Chilkat2 PHP
Load XML from a Remote URL
Demonstrates how to load XML from a remote URL, such as https://www.chilkatsoft.com/hamlet.xmlChilkat PHP Downloads
<?php
use Chilkat2\Http;
use Chilkat2\StringBuilder;
use Chilkat2\Xml;
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
$http = new Http();
$sbXml = new StringBuilder();
// Download the XML from the URL into sbXml
try {
$http->QuickGetSb('https://www.chilkatsoft.com/hamlet.xml', $sbXml);
$xml = new Xml();
// Load the XML contained in sbXml
$xml->LoadSb($sbXml, true);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
echo "Success.\n";