PHP code example of uniphil / merge-rss

1. Go to this page and download the library: Download uniphil/merge-rss library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

uniphil / merge-rss example snippets


$feed1 = simplexml_load_string(
    '<?xml version="1.0">
    <rss version="2.0">
      <channel>
        <item>
          <title>An older post from one feed</title>
          <pubDate>2016-01-01</pubDate>
        </item>
      </channel>
    </rss>');

$feed2 = simplexml_load_string(
    '<?xml version="1.0">
    <rss version="2.0">
      <channel>
        <item>
          <title>A recent post from another</title>
          <pubDate>2016-11-12</pubDate>
        </item>
      </channel>
    </rss>');

$merged = MergeRSS\merge_rss(array($feed1, $feed2));
echo $merged->asXML();