I'm trying to print an xml feed into my php page,but this code is not working correctly, and i have no idea why. It just shows the code as it is on the browser from xpath to ?> . Can anyone help me with this please
<html>
<head>
<title>XML FEED</title>
</head>
<body>
<ul>
<?php
$dom = simplexml_load_file("http://feeds.bbci.co.uk/news/rss.xml");
foreach ($dom->xpath("/channel/item") as $item)
{
print "<li>";
print $item->title;
print "</li>";
}
?>
</ul>
</body>
</html>