set_feed_url('http://michellejoklomp.blogspot.com/feeds/posts/default'); // Blogspot //$feed->set_feed_url('http://simplepie.org/blog/feed/'); // WordPress $success = $feed->init(); // Set the HTTP headers once, at the very top of the page. $feed->handle_content_type(); // If processing was successful and we have data... if ($success && $feed->data) { // If the feed had an error, explode into a gigantic ball of flames! if ($feed->error()) { die($feed->error()); } // Display the title of the feed. echo '
' . $item->get_date() . '
' . "\n"; echo '' . strip_tags($item->get_description()) . '
' . "\n"; // Try to pull the comment feed URL. Finding comments in feeds is vague and non-standardized, so we'll ONLY check the ones we know: WordPress and Blogspot. if ($item->get_link(1, 'replies')) { // Set the Blogspot comment feed URL. $comment_feed_url = $item->get_link(1, 'replies'); } else { // Set the WordPress comment feed URL. $comment_feed_url = $item->get_item_tags('', 'comments'); $comment_feed_url = str_replace('#comments', 'feed/', $comment_feed_url[0]['data']); } // Instantiate a new SimplePie object for the comments. $comments = new SimplePie(); $comments->set_feed_url($comment_feed_url); $comments_success = $comments->init(); // If processing was successful and we have data... if ($comments_success && $comments->data) { echo 'Comments:' . "\n"; echo '