I have an XML with this structure:
Code: Select all
<item>
<title><![CDATA[Here is the title of the item]]></title>
<link><![CDATA[http://www.thedomain.com]]></link>
<description><![CDATA[The content of the item]]></description>
<enclosure url="http://www.thedomain.com/theimage.jpg" length="17800" type="image/jpeg"/>
</item>Code: Select all
<?php
function getFeed($feed_url) {
$content = file_get_contents($feed_url);
$x = new SimpleXmlElement($content);
echo "<ul>";
foreach($x->channel->item as $entry) {
echo "
<li>
<a href='$entry->link' title='$entry->title' target='_blank'>" . $entry->title . "</a>
</li>";
}
echo "</ul>";
}
?>Code: Select all
<?php
function getFeed($feed_url) {
$content = file_get_contents($feed_url);
$x = new SimpleXmlElement($content);
echo "<ul>";
foreach($x->channel->item as $entry) {
echo "
<li>
<a href='$entry->link' title='$entry->title' target='_blank'><img src='THE-IMAGE-HERE'>" . $entry->title . "</a>
</li>";
}
echo "</ul>";
}
?>