Page 1 of 1

Combining Two rss feeds and display latest blogs in site

Posted: Wed Sep 21, 2011 10:31 pm
by rajesh1986
Hi,

I combined rss feeds from blogs into one feed using yahoo pipes.I can display the blogs feeds in my website.The code for that is included here.what i want is i want to display the most recent blogs .can any one help me with that code?

Thanks in advance

Code: Select all


<?php 
	
	// this is the url of the rss feed that you want to display
$feed = curl_init('http://feeds.feedburner.com/mostRecentBlogs');
curl_setopt($feed, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($feed, CURLOPT_HEADER, 0);
$xml = simplexml_load_string(curl_exec($feed));
curl_close($feed);

//if the feed exists, then continue...
if ($xml!=''){
$number=$xml->channel->item;

print_r($number);
$i=0;
foreach ($number as $item){
if($i<5)
{

// create variables from the title and description (can also be used for images and links)
$title = $item->title;
$description = $item->description;
$publishdate = $item->pubDate;
$time=strtotime($publishdate);






//displays the title and description on your website, formatted any way you want
echo '<p><b><a href="$link">'.$title.'</a></b></p>';
}
$i++;

}}
?>