Jump to content

Pulling in an rss feed..


chelnov63

Recommended Posts

hi there..im struggling a bit and not sure how to pull in an rss feed using php and display it in a table:

 

for e.g consider http://blog.myspace.com/blog/rss.cfm?friendID=84825413

 

how using php should i pull this in... or do i need a third party component or prebuilt classes to parse the XML? thanks in advance..i tried googling and stuff but cant seem to find an answer  .. any tips advice would really be appreciated..thanks

Link to comment
https://forums.phpfreaks.com/topic/120872-pulling-in-an-rss-feed/
Share on other sites

thanks for your advice...

 

I'm trying this:

 

<?php
$source = 'http://blog.myspace.com/blog/rss.cfm?friendID=84825413';

// load as file
$sitemap = new SimpleXMLElement($source,null,true);

foreach($sitemap as $item)
{
echo "{$item->title}";
}
?>

 

I expected all the item titles to be displayed but all i get is:

 

Nick Harrison - MySpace Blog

 

Do you have any idea where i am going wrong... thanks for your help mate

got it figured no worries:

 

<?php
$source = 'http://blog.myspace.com/blog/rss.cfm?friendID=84825413';
// load as file
$sitemap = new SimpleXMLElement($source,null,true);


// Here we'll put a loop to include each item's title and description
foreach ($sitemap->channel->item as $item) {
  echo "$item->title<br>";

}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.