Create a SimpleXMLElement object from a URL in PHP

Description

The following code shows how to create a SimpleXMLElement object from a URL.

Example


  /*from w w w  . j a  v a2  s. c om*/
<?php
   $xml=new SimpleXMLElement("test.xml",NULL,TRUE);
   echo $xml->asXML();
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    XML »




DOM
SimpleXML
SimpleXMLElement
XML Parser