How can I add my desired links to be read using PHP Universal FeedParser
Posted
by lightingwrist
on Stack Overflow
See other posts from Stack Overflow
or by lightingwrist
Published on 2010-04-14T20:30:24Z
Indexed on
2010/04/14
20:33 UTC
Read the original article
Hit count: 328
Hello, I have been trying to use the PHP Universal FeedParser to read RSS feeds and display the output on my site. Problem is I am VERY green with this and although it seems very simple. the only link that is working is the link provided in the sample. When I try to add another address with the xml or rss.php extensions, I keep getting errors,the page is loading blank,or the designated area for the feeds is blank. In addition to this, how can I add multiple links to feeds in a syntactically correct manor and how can I limit the amount of feeds? Thank you
Here it is:
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/includes/system/FeedParser.php');
$Parser = new FeedParser();
$Parser->parse("http://www.sitepoint.com/rss.php");
$channels = $Parser->getChannels();
$items = $Parser->getItems();
?>
and then:
<div id="rss_feeder">
<h1 id="title"><a href="<?php echo $channels['LINK']; ?>"><?php echo $channels['TITLE']; ?></a></h1>
<p id="description"><?php echo $channels['DESCRIPTION']; ?> </p>
<?php foreach($items as $item): ?>
<a class="feed-title" href="<?php echo $item['LINK']; ?>"><?php echo $item['TITLE']; ?></a>
<p class="feed-description"><?php echo $item['DESCRIPTION']; ?></p>
<?php endforeach;?>
</div>
© Stack Overflow or respective owner