I tried SimpleXML, but my host is still running PHP 4.4.0 ;-(
so I tried here:
http://www.criticaldevelopment.net/xml/doc.php
where there's a PHP4 parser, but I get no output
(well other than the 'Hello" I put in to test it was running.)
[HTML]<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<?php
include 'xml_parser.php';
//Get the XML document loaded into a variable
$xml = file_get_contents('myXMLfile.xml'); //which has "var1" as the 1st variable"
//Set up the parser object
$parser = new XMLParser($xml);
//Work the magic...
//Echo the plot of the first <movie>
echo "hello";
echo $parser->document->var1[0]->tagData;
?>
</body>
</html>[/HTML]
Can anyone spot where I'm going wrong? - thanks
---
EDITED UPDATE: Well I continued (trial & error) testing, ... inserted:
$parser->Parse(); // which I hadnt understood from the exaple was needed.
It still didnt work ;-?
Then I removed my "echo "hello" line and mysteriously it now works.
Why would the echo "hello" stop it working? / what's the scope of a variable in PHP? - thanks