Welcome to WebmasterWorld Guest from 54.163.49.19

Forum Moderators: bill & werty

Message Too Old, No Replies

Using Magpie: Selecting the RSS Feed Information, (not the individual

I am using Magpie and I just want to parse out the RSS feed information

     
2:41 am on Jan 29, 2006 (gmt 0)

New User

10+ Year Member

joined:Nov 12, 2005
posts:10
votes: 0


I am trying to find a way to print the top information about an RSS file. For instance I am using the following CNET RSS file:

[export.cnet.com...]

You will see the top few lines of the feed are:

<title>CNET News.com</title>
<link>http://news.com.com/</link>
<description>
Tech news and business reports by CNET News.com. Focused on information technology, core topics include computers, hardware, software, networking, and Internet media.
</description>

These are not <item> tags -- this is the top part of the CNET News RSS.

I want to parse this information and insert it into a database so how would I put each <tag> into its own variable $sitetitle, $sitelink, $sitedescription?

I imagine

foreach ($rss->items as $item ) {

doesn't work since these aren't items, how would one do it?

12:15 pm on Jan 29, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 11, 2002
posts:86
votes: 0


These infos should be in the $rss->channel array, e.g. $rss->channel["title"]. Try

foreach ($rss->channel as $key=>$value) {
echo $key.": ".$value;
}