{"id":3935,"date":"2016-02-24T18:59:20","date_gmt":"2016-02-24T10:59:20","guid":{"rendered":"http:\/\/www.janleow.com\/life\/?p=3935"},"modified":"2016-02-24T19:07:01","modified_gmt":"2016-02-24T11:07:01","slug":"combine-rss-feed-into-one","status":"publish","type":"post","link":"https:\/\/www.janleow.com\/life\/combine-rss-feed-into-one.html","title":{"rendered":"Combining multiple RSS feed into one output"},"content":{"rendered":"<p>Ever since Yahoo Pipes service was shut down, I\u2019ve been looking for a good alternative to merge my various RSS feeds. My website is composed of several sections using WordPress, Google Blogger and Tumblr. I have tried some free services out there but they were never as good as Yahoo Pipes. And without a good monetizing idea, those services too, died in the end. Leaving me in the lurch yet once again. Finally I decided to search out some code that would sit in my own web server and never have to worry about such services shutting down.<\/p>\n<p><!--more--><\/p>\n<p>My first try was a code that I found called Feedcreator using magpie. It could handle feeds created by WordPress and Tumblr but not Google Blogger. I tried several workarounds including passing the Blogger feeds into Feedburner and inserting it back to Feedcreator, but it didn\u2019t work.<\/p>\n<p>Then it occurred to me that Simplepie may just get the job done. Currently I\u2019m using it to combine my blog output onto my homepage. So it is just a matter of finding the code sequence. Unfortunately Simplepie site documentation weren\u2019t very clear on how to do it, but I managed to eventually track down a few sites giving examples on how to get it done.<\/p>\n<p>First off, the command code to output the combined RSS feed is:<\/p>\n<table>\n<tr>\n<td>\n<div style=\"border: 1px solid grey; background: ghostwhite; padding:3em;\">\n&nbsp;&nbsp;enable_xml_dump(isset($_GET[&#8216;xmldump&#8217;]) ? true : false)\n<\/div>\n<p><br break=all\/><\/p>\n<p>This will dump the output as an XML formatted data to be later echoed out with other Simplepie commands. One of the author suggested using Feedburner to created a much nicer looking formatting after creating the RSS XML file which suits me just fine.<\/p>\n<p>Without much ado, here\u2019s my example after modifying it to suit my needs. You may want to customize it further for your purposes. You will need to download the simplepie.inc file and placed it somewhere in your web server for this to work and of course a writable cache folder for simpiepie to store its temporary output.<\/p>\n<p><br break=all\/><\/p>\n<div style=\"border: 1px solid grey; background: ghostwhite; padding:3em;\">\n<p>&#10;&#10;&#10;<br \/>\n&#60;?php<br \/>\n\/****************************************************<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RSS FEED USING SIMPLEPIE XML DUMP<br \/>\n****************************************************\/<br \/>\nrequire_once(&#8216;.\/simplepie_folder\/simplepie.inc&#8217;);\/\/INCLUDE EXTERNAL LIBRARIES<br \/>\nheader(&#8216;Content-Type: application\/rss+xml; charset=UTF-8&#8217;); \/\/ SET HTTP HEADERS<br \/>\n?><\/p>\n<p>&#60;rss version=&#8221;2.00&#8243;&#62;<br \/>\n&#60;channel&#62;<br \/>\n&#60;title&#62;Jan Leow Homepage&#60;\/title&#62;<br \/>\n&#60;link&#62;http:\/\/www.janleow.com&#60;\/link&#62;<br \/>\n&#60;description&#62;Jan Leow RSS Feed Combined&#60;\/description&#62;<br \/>\n&#60;language&#62;en-us&#60;\/language&#62;<\/p>\n<p>&#10;&#10;&#10;<br \/>\n&#60;?php<br \/>\n$feed = new SimplePie(); \/\/ Create a new instance of SimplePie<br \/>\n\/\/ Load the feeds<br \/>\n$feed-&#62;set_feed_url(array(<br \/>\n&#8216;http:\/\/tumblr.janleow.com\/rss&#8217;,<br \/>\n&#8216;http:\/\/go.janleow.com\/feeds\/posts\/default&#8217;,<br \/>\n&#8216;http:\/\/www.janleow.com\/life\/feed&#8217;,<br \/>\n&#8216;http:\/\/web.janleow.com\/photography-basics\/feed&#8217;<br \/>\n));<br \/>\n$feed-&#62;set_cache_duration (600); \/\/ Set the cache time<br \/>\n$feed-&#62;enable_xml_dump(isset($_GET[&#8216;xmldump&#8217;]) ? true : false); \/\/ output as raw XML<br \/>\n$success = $feed-&#62;init(); \/\/ Initialize SimplePie<br \/>\n$feed-&#62;handle_content_type(); \/\/ Take care of the character encoding<br \/>\n?&#62;<\/p>\n<p>&#10;&#10;&#10;<br \/>\n&#60;?php<br \/>\n\/\/ limit loop for the output<br \/>\nif ($success) {<br \/>\n$itemlimit=0;<br \/>\nforeach($feed-&#62;get_items() as $item) {<br \/>\nif ($itemlimit==20) { break; }<br \/>\n?&#62;<\/p>\n<p>&#10;&#10;&#10;<br \/>\n&#60;item&#62;<br \/>\n&#60;title&#62;&#60;?php echo $item-&#62;get_title(); ?&#62;&#60;\/title&#62;<br \/>\n&#60;link&#62;&#60;?php echo $item-&#62;get_permalink(); ?&#62;&#60;\/link&#62;<br \/>\n&#60;guid&#62;&#60;?php echo $item-&#62;get_permalink(); ?&#62;&#60;\/guid&#62;<br \/>\n&#60;description&#62;&#60;?php echo $item-&#62;get_description(); ?&#62;&#60;\/description&#62;<br \/>\n&#60;pubDate&#62;&#60;?php echo $item-&#62;get_date(&#8216;j F Y | g:i a&#8217;); ?&#62;&#60;\/pubDate&#62;<br \/>\n&#60;\/item&#62;<\/p>\n<p>&#60;?<br \/>\n$itemlimit = $itemlimit + 1;<br \/>\n}<br \/>\n}<br \/>\n?&#62;<br \/>\n&#60;\/channel&#62;<br \/>\n&#60;\/rss&#62;<\/p>\n<p>&#10;&#10;&#10;\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Ever since Yahoo Pipes service was shut down, I\u2019ve been looking for a good alternative to merge my various RSS feeds. My website is composed of several sections using WordPress, Google Blogger and Tumblr. I have tried some free services out there but they were never as good as Yahoo Pipes. And without a good &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.janleow.com\/life\/combine-rss-feed-into-one.html\"> <span class=\"screen-reader-text\">Combining multiple RSS feed into one output<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[12],"tags":[83,162],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1bS5F-11t","jetpack-related-posts":[{"id":1230,"url":"https:\/\/www.janleow.com\/life\/remove-and-get-rid-of-feedproxy-in-feedburner.html","url_meta":{"origin":3935,"position":0},"title":"Remove and Get Rid of Feedproxy in Feedburner","author":"Jan","date":"28 January 2010","format":false,"excerpt":"I noticed that some of my RSS feeds from Feedburner have the feedproxy.google.com domain and a long squiggly URL. I would like to remove and get rid of the feedproxy in my feedburner feeds and would much prefer to have the URL with my own domain and the webpage URL\u2026","rel":"","context":"In &quot;Website&quot;","block_context":{"text":"Website","link":"https:\/\/www.janleow.com\/life\/category\/website"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.janleow.com\/imgs\/wp\/feedproxy-getrid.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":643,"url":"https:\/\/www.janleow.com\/life\/yahoo-site-explorer.html","url_meta":{"origin":3935,"position":1},"title":"Yahoo Site Explorer","author":"Jan","date":"28 March 2008","format":false,"excerpt":"The Yahoo Site Explorer is a tool for you to view and manage your website web pages, to find out which pages were indexed by Yahoo and to control which pages should or should not be indexed by Yahoo. By submitting your website into the Yahoo Site Explorer, you could\u2026","rel":"","context":"In &quot;Website&quot;","block_context":{"text":"Website","link":"https:\/\/www.janleow.com\/life\/category\/website"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1484,"url":"https:\/\/www.janleow.com\/life\/multiposting-hits-a-snag.html","url_meta":{"origin":3935,"position":2},"title":"Multiposting hits a snag","author":"Jan","date":"7 May 2010","format":false,"excerpt":"I\u2019m trying to create as much exposure as I can by using multiposting services like Twitterfeed which in turns repost to other multipost web apps like HelloTxt and Ping.fm. Unfortunately something broke in Twitterfeed, it couldn\u2019t recognize the API provided by Ping.fm. I could of course shift most of my\u2026","rel":"","context":"In &quot;Website&quot;","block_context":{"text":"Website","link":"https:\/\/www.janleow.com\/life\/category\/website"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2944,"url":"https:\/\/www.janleow.com\/life\/removed-infolinks-code.html","url_meta":{"origin":3935,"position":3},"title":"Removed Infolinks Code","author":"Jan","date":"21 March 2011","format":false,"excerpt":"Finally removed Infolinks code since it conflicts with Kontera T&Cs. I had to remove the related tags as well when Kontera send me another mail saying that has to be removed too. I was still thinking of testing out Infolinks somehow. Since Kontera and Infolinks must not show at the\u2026","rel":"","context":"In &quot;Website&quot;","block_context":{"text":"Website","link":"https:\/\/www.janleow.com\/life\/category\/website"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1488,"url":"https:\/\/www.janleow.com\/life\/playing-around-with-dns-zone.html","url_meta":{"origin":3935,"position":4},"title":"Playing Around with DNS Zone","author":"Jan","date":"7 May 2010","format":false,"excerpt":"I've been tinkering and fiddling with my domain DNS zone. I tweak my website a lot. This is one interesting hobby, making website, experimenting with a feature here and there and trying something new and see whether it will be useful widget or just some red herring. DNS zoning is\u2026","rel":"","context":"In &quot;Website&quot;","block_context":{"text":"Website","link":"https:\/\/www.janleow.com\/life\/category\/website"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1299,"url":"https:\/\/www.janleow.com\/life\/make-create-build-a-free-web-site.html","url_meta":{"origin":3935,"position":5},"title":"Build a free web site","author":"Jan","date":"31 March 2009","format":false,"excerpt":"Everybody loves it when it is free. Free webmail, sign up free for this, for that and of course you can build a free web site. So is free web site hosting really cut out to be what it is? Well, yes and no. Nothing is absolutely free. You still\u2026","rel":"","context":"In &quot;Website&quot;","block_context":{"text":"Website","link":"https:\/\/www.janleow.com\/life\/category\/website"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.janleow.com\/life\/wp-json\/wp\/v2\/posts\/3935"}],"collection":[{"href":"https:\/\/www.janleow.com\/life\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.janleow.com\/life\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.janleow.com\/life\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.janleow.com\/life\/wp-json\/wp\/v2\/comments?post=3935"}],"version-history":[{"count":13,"href":"https:\/\/www.janleow.com\/life\/wp-json\/wp\/v2\/posts\/3935\/revisions"}],"predecessor-version":[{"id":3948,"href":"https:\/\/www.janleow.com\/life\/wp-json\/wp\/v2\/posts\/3935\/revisions\/3948"}],"wp:attachment":[{"href":"https:\/\/www.janleow.com\/life\/wp-json\/wp\/v2\/media?parent=3935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.janleow.com\/life\/wp-json\/wp\/v2\/categories?post=3935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.janleow.com\/life\/wp-json\/wp\/v2\/tags?post=3935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}