How can I display RSS feed on mysite?

Hello Everyone!

Hope you all are doing well.

If you want to display the content from any blog on your site through the RSS FEED then please use my code.

I hope this will be very help full for you 🙂

    $rss = new DOMDocument();
    $rss->load(''); //RSS FEED URL
    $feed = array();
    foreach ($rss->getElementsByTagName('item') as $node) {
    $item = array (
    'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
    'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
    'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
    'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
    array_push($feed, $item);
    $limit = 5;
    for($x=0;$x<$limit;$x++) {
    $title = str_replace(' & ', ' &amp; ', $feed[$x]['title']);
    $link = $feed[$x]['link'];
    $description = $feed[$x]['desc'];
    $date = date('l F d, Y', strtotime($feed[$x]['date']));
    echo '<p><strong><a href="'.$link.'" title="'.$title.'">'.$title.'</a></strong><br />';
    echo '<small><em>Posted on '.$date.'</em></small></p>';
    echo '<p>'.$description.'</p>';

Enjoy Code! (code provided by Raghunath )


Sr. Software Engineer

Tagged with: , , ,
Posted in Drupal, Joomla, PHP, Wordpress
4 comments on “How can I display RSS feed on mysite?
  1. Simply wish to say your article iss as amazing.

    The clearness in your post iss simply nice and i can suppose
    you are an expert on this subject. Fine with your permission let me to clutch your feed to keep updated with drawing close
    post. Thank yoou a million and please keep up the gratifying work.

  2. joan says:

    It¡¦s actually a nice and helpful piece of info. I am satisfied that you shared this useful information with us. Please stay us informed like this. Thanks for sharing.

  3. Wonderful article! That is the kind of information that are
    supposed to be shared around the web. Shame
    on Google for not positioning this post upper!
    Come on over and consult with my site . Thanks =)

  4. Google says:


    Just beneath, are various entirely not associated websites to ours, nonetheless, they’re surely worth going over.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Recent Posts
%d bloggers like this: