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 )

4 Replies to “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. 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. Pingback: Google

Leave a Reply

Your email address will not be published. Required fields are marked *