Hello,
I'm new to PHP and am trying to code a parser using magpie RSS to display data from an RSS xml feed. I initially managed to get a crude version to work which would only display the title of the article as a link to the original page.
I am trying to get something more advanced so that the php code pulls, the title, link of the article, date and then part of the description and displays it as:
<a href="link">title</a>, month/day/year -- description
<a href="link">title</a>, month/day/year -- description
etc..
I would also like to be able to limit the size of the description to the first 100 characters.
Can anyone help?
Thanks!!
Here's my coding attempt:
<?php
include('rss/rss_fetch.inc');
$url =
"http://www.voanews.com/english/customCF/RecentStoriesRSS.cfm?
keyword=TopStories";
$rss_data = fetch_rss($url);
if ($rss) {
foreach ($rss_data->items as $rss_item ) {
$rss_title = $rss_item['title'];
$item_link = $rss_item['link'];
$rss_pubDate = $rss_item['date_timestamp'];
$rss_description = $rss_item['description'];
echo "<p><a href=$item_link>$rss_title</a> - " . date("m/d/Y",
$rss_pubDate) . " - ". $rss_description ."\n";
}
?>