I use RSS parser SimplePie in my site. SimplePie multifeeds code normally has something like this at the top:
$feeds = array(
'http://www.bloggerperson.com/feed.atom',
'http://www.yetanotherblog.com/?feed=rss2',
'http://feeds.feedburner.com/blogger',
);
I want to fill that list of RSS feeds from the database.
This script produces a nice list:
$query="SELECT rssfeed FROM users WHERE rssfeed!=''";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$rssfeed=mysql_result($result,$i,"rssfeed");
echo "'$rssfeed',<br />";
$i++;
}
The output looks something like this:
'http://www.bloggerperson.com/feed.atom',
'http://www.yetanotherblog.com/?feed=rss2',
'http://feeds.feedburner.com/blogger',
Exactly what I need. But how can I insert this output into the SimplePie script instead of echo-ing it on the page?
I suspect I need to put it into a function with return instead of echo. The SimplePie code would look something like this:
$feeds = array(
feedlist()
);
But I don't really have a clue how to do that. I've tried all kinds of variations without luck. Am I on the right track? Is it possible to use results from one part of the script as input for other parts? How?