Hello:
I’m trying to grab data from an XML file and display it in the body of my HTML using XML parser in PHP. (trying to display ANY of the XML data right now)
so if I have an blank HTML paragraph:
echo('<p>');
echo('</p>');
and i’m using SimpleXML:
$xml = simplexml_load_file('myXML.xml');
echo $xml->item[0]->title;
I want to grab the value of the attribute “title” in node 0 and display it in the HTML paragraph. I’ve run into everything from parser errors to the fatal “call to undefined object” error. I also tried to use eval and got stuck:
eval("\$xml = simplexml_load_file('myXML.xml')");
echo $xml->item[0]->title;
I think I’m on the right track but need help constructing this. I’d like to place the simpleXML portion within the paragraph tags.