Sample code for 30+ languages & platforms
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

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

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

$http = new COM("Chilkat.Http");
$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;
}

$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";

?>