I've started with very basic example in order to understand how to read data from XML. So, test.xml and index.php are located in the root directory. The following code of index.php returns Failed Loading XML. Why this actually happens?
<?php
$source = './test.xml';
loadXml($source);
function loadXml($source){
/*
* Checks for xml file errors
*/
libxml_use_internal_errors(true);
$xml = simplexml_load_file($source);
if (!$xml){
echo "Failed Loading XML\n";
foreach(libxml_get_errors() as $error){
echo "\t", $error->message;
}
} else {
print_r($xml);
}
// etc....
}
?>