Receiving parsed RSS feed data into PHP (Problem)
Posted: Fri Dec 04, 2009 3:11 pm
Hi, Can anybody please explain to me what is wrong with my code below, I have been trying to retrieve an images URL from an RSS feed to display on my website but the code I have written does not get the image url or length. But I am able to retrieve feed titles, descriptions, etc...
But this source will just not work, I have tried so many variations of this code and still nothing, what am I doing wrong. BTW I am using the free opensource Magpie rss reader, which works freat by the way, with the exception of the <enclosure> element which I just cannot get to work. Any help will be greatly appreciated!
Here is what I am doing:
All I need is to display one little picture, surely it can't be that involved or am I just missing the point completely?
Thanks in advance
Grant
But this source will just not work, I have tried so many variations of this code and still nothing, what am I doing wrong. BTW I am using the free opensource Magpie rss reader, which works freat by the way, with the exception of the <enclosure> element which I just cannot get to work. Any help will be greatly appreciated!
Here is what I am doing:
Code: Select all
<?php
include_once('magpie/magpierss/rss_fetch.inc');
define('MAGPIE_CACHE_DIR', '/cache');
define('MAGPIE_CACHE_AGE', 900);
$feed = 'http://feeds.iol.co.za/iol_new/thumbtribe/picture_iol_frontpage.rss';
$rss = fetch_rss($feed);
$items = $rss->items;
$title = $item['title'];
$url = $item['link'];
$description= $item['description'];
$picuri = $item['enclosure'][0]['url'];
$enclosure = $item['enclosure'][0]['length'];
echo "<enclosure url='".$picuri."' length='".$enclosure."' type='MIME' title='big'>\n";
echo "<div class=\"right1\" style=\"width: 100%; text-align:left; padding-top:5px; padding-left:37px; padding-right:37px\"><font color=\"#000000\" style=\"font-size: 11px; text-align: justify;\">".$description."</font>\n";
?>Thanks in advance
Grant