SimpleXML query
Posted: Fri Nov 07, 2008 1:16 pm
I'm still struggling with this I'm afaid. I'm trying to get simplexml to read the remote url here http://www.ecb.europa.eu/stats/eurofxre ... -daily.xml and return a html array of currencies and rates.
The code below I use renders a blank page. any ideas anybody? thanks Conor
The code below I use renders a blank page. any ideas anybody? thanks Conor
Code: Select all
<?php // Load and parse the XML document
$rss = simplexml_load_file('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml'); ?>
<html xml:lang="en" lang="en">
<head> </head>
<body>
<?php
// Here we'll put a loop to include each item's title and description
foreach ($rss->gesmes:Envelope->Cube as $item) {
echo "<p>" . $item->currency ."</p>";
echo "<p>" .$item->rate . "</p>";
}
?>
</body>
</html>