---
title: 'WOW RSSX PHP Class - Display Multiple Feeds using SimpleXML'
url: 'https://worldoweb.co.uk/2018/wow-rssx-display-multiple-feeds-using-simplexml'
markdown: 'https://worldoweb.co.uk/2018/wow-rssx-display-multiple-feeds-using-simplexml.md'
date: '2018-02-05'
description: 'WOW RSSX is a PHP script that fetches either a single or multiple RSS Feeds and combines them to display on your website along with categories and dates.'
taxonomy:
  category:
    - 'Web Development'
  tag:
    - PHP
    - Script
    - Resources
    - RSS
---

# WOW RSSX PHP Class - Display Multiple Feeds using SimpleXML

 Published on February 5, 2018 by Tracy Ridge in  [Web Development](https://worldoweb.co.uk/category/category:Web%20Development) 

WOW RSSX is another PHP script that fetches either a single or multiple RSS Feeds and combines them to display on your website along with categories and dates. With added options, you can tailor the output to suit your needs. The difference between the recently published [WOW RSS](https://www.worldoweb.co.uk/2018/wow-rss-php-class-combine-and-display-multiple-rss-feeds) and WOW RSSX is that this script uses SimpleXML and WOW RSS uses cURL to fetch the feeds and JSON to convert the feeds from a SimpleXML object to a PHP array.

Table of contents

- [Speed Tests](#one)
- [Prerequisites](#two)
- [Download](#three)
- [How to Use WOW RSSX](#four)
    - [$urls](#urls)
    - [$maxitems](#maxitems)
    - [$date\_format](#date_format)
    - [$sort\_feed](#sort_feed)
- [Examples-Single Feeds](#five)
- [Examples – Multiple Feeds Combined](#six)
- [Styling Your Feeds](#seven)
- [Further Improvements](#eight)
- [Sources](#nine)

## Speed Tests

Using the following code testing [function](https://gist.github.com/samarpanda/4125105) to measure the execution time and memory usage to fetch 50 latest articles from 3 URLs. WOW RSSX was slightly slower but also used less memory during the process.

## Prerequisites

WOW RSSX has been tested on PHP 5.6 and 7.03. Please get [in touch](https://www.worldoweb.co.uk/contact) if you require help.

## Download

Simply download, extract and place it on your PHP enabled webserver. Version 1.0 Released- 5th February 2018

[Download WOW RSSX](https://www.worldoweb.co.uk/user/pages/downloads/WOW-RSSX-1.0.zip)

## How to Use WOW RSSX

Once installed on your server you need to include the script on your PHP page.

```php
<?php

include 'wow_xml.php';

//If it's in a subdirectory i.e class

include 'class/wow_xml.php';

?>
```

Now we need to create a new instance of the class:

```php
feed = new WowMultiXml($urls,$maxitems,$date_format,$sort_feed);

echo $feed->displayRss();
```

WowMultiXML take 4 arguments.

#### $urls

(Array|String) **Required** The URL(s) of the feeds you want to fetch.

#### $maxitems

(String|Int) **Required** The number of feeds you want to display.

#### $date\_format

(String) **Required** The date format you want to display. – See https://php.net/manual/en/function.date.php An empty string will remove all dates from the output.

#### $sort\_feed

(Array|Bool) **Required** The order in which you want to sort your feeds. Defaults to newest first if true is set.

## Examples-Single Feeds

To display a single feed with the **latest 10 items** sorted with newest at the top and the **date format Jan 18**.

```php
$url = "http://feeds.bbci.co.uk/news/video_and_audio/technology/rss.xml";
$date_format = 'M j';
$sort_feed = array('sort_order'=>'new_first');

$feed = new WowMultiXml($url,'10',$date_format,$sort_feed);
echo $feed->displayRss();

```

The same can also be achieved by the following

```php
$url = "http://feeds.bbci.co.uk/news/video_and_audio/technology/rss.xml";

$feed = new WowMultiXml($url,'10','M j',true);
echo $feed->displayRss();

```

Display’s a single feed with **20 items** sorted with oldest at the top and the **date format** 1-18-18

```php

$url = "http://feeds.bbci.co.uk/news/video_and_audio/technology/rss.xml";
$date_format = 'n-j-y';
$sort_feed = array('sort_order'=>'old_first');

$feed = new WowMultiXml($url,20,$date_format,$sort_feed);
echo $feed->displayRss();

```

To display 2 single feeds with different options

```php
/*Feed 1*/
$url = "http://feeds.bbci.co.uk/news/rss.xml?edition=uk";
$date_format = 'n-j-y';

$feed = new WowMultiXml($url,5,$date_format,true);
echo $feed->displayRss();

/*Feed 2*/

$url2 = "http://feeds.bbci.co.uk/news/video_and_audio/technology/rss.xml";
$sort_feed2 = array('sort_order'=>'old_first');

$feed2 = new WowMultiXml($url2,'5','j F, Y',$sort_feed2);
echo $feed2->displayRss();

```

## Examples – Multiple Feeds Combined

Displays latest **50 items** from **3 Combined Feeds** with the date format **18 January 2018**, sorted by **newest first**.

```php
$url = "http://feeds.bbci.co.uk/news/rss.xml?edition=uk";
$url2 = "http://feeds.bbci.co.uk/news/video_and_audio/technology/rss.xml";
$url3 = "http://feeds.bbci.co.uk/news/video_and_audio/uk/rss.xml";

//Above feeds Combined in array for combined multiple feeds
$urls = array($url,$url2,$url3);

$date_format = 'j F, Y';

$feed = new WowMultiXml($urls,50,$date_format,true);
echo $feed->displayRss();

```

This final example displays the latest **10 items** from **3 Combined Feeds** with the no **date format**, sorted by **newest first**

```php
$url = "http://feeds.bbci.co.uk/news/rss.xml?edition=uk";
$url2 = "http://feeds.bbci.co.uk/news/video_and_audio/technology/rss.xml";
$url3 = "http://feeds.bbci.co.uk/news/video_and_audio/uk/rss.xml";

//Above feeds Combined in array for combined multiple feeds
$urls = array($url,$url2,$url3);

//If you don't want the date to be displayed leave the string empty
$feed = new WowMultiXml($urls,10,'',true);
echo $feed->displayRss();

```

## Styling Your Feeds

You can optimise the style of your feeds easily using CSS. I have therefore included a CSS file in the download for your reference. The classes to edit are:

```css
.wow_feed {
}
.wow_feed h2 a {
}
.wow_feed h2 a:hover {
}
.wow_feed .cat,
.wow_feed .date {
}
```

## Further Improvements

Furthermore, if you would like to suggest an improvement to the code or request a new feature then please do get in touch. Although the code has been tested quite thoroughly it shouldn’t contain any bugs. Please report them if you do come across any. Please remember that RSS is quite limited and in order for the script to work you have to have a valid RSS feed(s).

## Sources

[PHP Date Function](http://php.net/manual/en/function.date.php)

### Share

 [X](https://x.com/intent/tweet?text=WOW%20RSSX%20PHP%20Class%20-%20Display%20Multiple%20Feeds%20using%20SimpleXML&url=https%3A%2F%2Fworldoweb.co.uk%2F2018%2Fwow-rssx-display-multiple-feeds-using-simplexml&via=worldoweb "Share on X") [Facebook](https://www.facebook.com/sharer.php?u=https%3A%2F%2Fworldoweb.co.uk%2F2018%2Fwow-rssx-display-multiple-feeds-using-simplexml "Share on Facebook") [Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fworldoweb.co.uk%2F2018%2Fwow-rssx-display-multiple-feeds-using-simplexml&title=WOW%20RSSX%20PHP%20Class%20-%20Display%20Multiple%20Feeds%20using%20SimpleXML "Share on Reddit") [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fworldoweb.co.uk%2F2018%2Fwow-rssx-display-multiple-feeds-using-simplexml "Share on LinkedIn") [Bluesky](https://bsky.app/intent/compose?text=WOW%20RSSX%20PHP%20Class%20-%20Display%20Multiple%20Feeds%20using%20SimpleXML%20https%3A%2F%2Fworldoweb.co.uk%2F2018%2Fwow-rssx-display-multiple-feeds-using-simplexml "Share on Bluesky") [Email](mailto:?subject=WOW%20RSSX%20PHP%20Class%20-%20Display%20Multiple%20Feeds%20using%20SimpleXML&body=https%3A%2F%2Fworldoweb.co.uk%2F2018%2Fwow-rssx-display-multiple-feeds-using-simplexml "Share via email") 

#### Tags

 [ PHP](https://worldoweb.co.uk/tag/tag:PHP) [ Script](https://worldoweb.co.uk/tag/tag:Script) [ Resources](https://worldoweb.co.uk/tag/tag:Resources) [ RSS](https://worldoweb.co.uk/tag/tag:RSS) 

##### Next

 [ ← Tips to Make Your YouTube Video More Professional ](https://worldoweb.co.uk/2018/tips-to-make-your-youtube-video-more-professional) 

OR

##### Previous

 [ WOW RSS PHP Class - Combine and Display Multiple RSS Feeds → ](https://worldoweb.co.uk/2018/wow-rss-php-class-combine-display-rss-feed)

---

## Navigation

- Previous: [Tips to Make Your YouTube Video More Professional](https://worldoweb.co.uk/2018/tips-to-make-your-youtube-video-more-professional.md)
- Next: [WOW RSS PHP Class - Combine and Display Multiple RSS Feeds](https://worldoweb.co.uk/2018/wow-rss-php-class-combine-display-rss-feed.md)
