RSS to Array PHP?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gblax123
Forum Newbie
Posts: 1
Joined: Wed Jul 14, 2010 8:39 am

RSS to Array PHP?

Post by gblax123 »

Hey everyone, I am new, and I have a question.

I need to access an RSS, and get the RSS posts into an array.

Is this possible, and if it is, how would I go about doing it?

Here is an example RSS that is exactly like the one I need:
http://services.runescape.com/m=adventu ... ame=Zezima

Thanks if you can help :)
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: RSS to Array PHP?

Post by AbraCadaver »

That's not an RSS feed, but to answer your question, something like this:

Code: Select all

$rss = (array)simplexml_load_file('feed.rss');
And if you wanted you could loop through and convert the object elements to arrays, but I would just use the whole thing as an object:

Code: Select all

$rss = simplexml_load_file('feed.rss');
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: RSS to Array PHP?

Post by josh »

It probably would be a RSS feed if we were authenticated. http://framework.zend.com/manual/en/zen ... g-rss.html

Zend will let you treat RSS just like an array.
Post Reply