Welcome to WebmasterWorld Guest from 23.22.79.235

Forum Moderators: bill & werty

Message Too Old, No Replies

How to use MagpieRSS and Read Feed URL from mySQL database?

How to use MagpieRSS and Read Feed URL from mySQL database?

   
2:43 am on Mar 9, 2008 (gmt 0)

5+ Year Member



I am currently using MagpieRSS on my site to read feed from my members' blog (they submit the feed URL).

All members' feed URL is storing in the mySQL database from the field "FEEDRSS". Some are empty.

I would like to create a page that use MagpieRSS to read all the feed URL from "FEEDRSS" and listed down all the new posts, is it possible?

Thank you very much for helping!

3:21 am on Mar 9, 2008 (gmt 0)

5+ Year Member



Below is the PHP codes that I use to read RSS using Magpie. How can I code to read all the URLs in the database and sort the posts as according to date?

{php}
//Include our magpie functions
require_once('magpierss/rss_fetch.inc');

//define our cache directory so we can cache the feed
define('MAGPIE_CACHE_DIR', 'cache/');

//set up our URL..much simplified in this case
$url = $this->get_template_vars('RSSFEED');

//get our feed
$rss = fetch_rss( $url );
$num_items = 5;

$rss->items = array_slice($rss->items, 0, $num_items);
//If we got a feed, let's process it
if ( $rss ) {
//Loop through all the items in the feed...
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
$desc= strip_tags($item['description']);

if (strlen($desc) >= 256)
{
$desc = substr($desc,0,255)." [...]";
}
//And print them
echo "<b><a href=$href>$title</a></b><br/>$desc<br/><br/>";
}
}
{/php}

8:55 am on Mar 9, 2008 (gmt 0)

5+ Year Member



Currently I am already using Magpierss to read individual rss url from database, which you can see at:

<snip>

However, I can only read ONE rss url (one website).

I want to read ALL URLs and parse the output into a page, sort via post date.

[edited by: werty at 6:44 pm (utc) on Mar. 9, 2008]
[edit reason] Removed URL, please see TOS #13 [/edit]

12:29 am on Mar 10, 2008 (gmt 0)

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



For very specific Magpie questions like this have you checked through the mailing list that they provide for support?