Stand-alone‎ > ‎

Warwick Blogs Grabber


Warwick Blogs Grabber is a PHP script I wrote to grab and process the RSS feed for my Warwick University blog, so I could display it on my website. Thanks to the flexibility of Warwick Blogs' RSS feeds, the number of entries shown is customisable.

Because the "Title" in all the RSS feeds is always the main title of the blog, the page title can be manually set if the feed is not the main feed (the feed for a tag, for example).

The author of an entry is not output by default, however it is extracted from the feed. If the author is required (for multi-user blogs, for example) then the appropriate code can be easily added or a "custom" display used (see below).

Since RSS is theoretically a standard, WBG should work with non-Warwick-Blogs feeds but may need some tweaking.

As of version Foxtrot it is now possible to use the script more than once on a single page.


NOTE: The example is non-functional; once I spend more time with Google Sites I'll hopefully get all the JavaScript working. At the moment my primary goal is availability of the scripts. The example is, however, a copy of the code generated from the List example before I moved the site to Google Sites.

Note that the "by" at the end of every title is actually in the RSS feed. It appeared at some point after I graduated. However since I lost access to my blog before then, having graduated, I've never got around to fixing it...


Since the processing of the feeds is the same in each case, the 'engine' is a single file that's referenced by each page that needs it. The referencing page is also where the options are set.

Set up


$zpagetitle='Entries tagged with "Video"';
$firstlink='&lt;&lt; Newest entries'
$prevlink='&lt; Newer entries'
$nextlink='Older entries &gt;'

include 'wbengine.php';



  • $wbrssurl - Required - This is the URL of the RSS feed; nothing can happen without it. Make sure you don't specify a normal page by mistake; WBG will still try its best to process it...
  • $wbmainfeed - Required - Used to specify whether or not the feed is the main feed for the blog. If this is set to 1 the URL and title of the page will be taken from the feed (which always displays the main blog's details); if this is set to 0 the URL will be taken from the specified URL of the feed and the title will be taken from the $zpagetitle variable.
  • $zpagetitle - Used to set the page title to something other than the main blog's title. If it's missing, the main blog's title from the feed will be used. This is only used if $wbmainfeed is set to 0.
  • $displaynum - The number of entries to show on one page. If this is not specified, or is negative, then the default of 10 will be used.
  • $firstlink - The text for the link pointing to the first page (if necessary). Has a default if not specified.
  • $prevlink - The text for the link pointing to the previous page (if necessary). Has a default if not specified.
  • $nextlink - The text for the link pointing to the next page (if necessary). Has a default if not specified.
  • $blogsort - Added in version Delta. Specifies how the entries are sorted. Can be set to "title" to sort by title, "reverse title" to reverse sort by title, "reverse" to reverse sort, or can be omitted to leave the entries in their original order.
  • $blogdisplay - Added in version Delta. Specifies how the entries will be output. Can be set to "normal", "raw", "list" (example above), or "custom". It will default to "normal" if nothing is specified, which is the full display as you'd expect it to appear.
  • include 'wbengine.php'; - Required - The line that actualy includes the engine. To be effective, all the options must be specified before this line. Remember to change this to reflect the location of wbengine.php on your server.

Custom Output

For custom output, with $blogdisplay set to "custom", Warwick Blogs Grabber will compile the $blogentries array but will not output it. This allows you to output the entries however you want. The best way to see the structure of the array is to first use the "raw" display option; this will output the array using HTML formatting (i.e. it will display correctly as a normal webpage). After that you can use your favourite method for looping through an array (such as foreach() in the example above) and then reference each item as you need it.

Most of the data is in its "raw" form; i.e. the link is the URL not an A tag, etc.


  • The "tags" are already links; they can just be output without futher work.
  • The "time" is just a timecode; it will need formatting with date().

Powered by WarwickBlogsGrabber

If you use Warwick Blogs Grabber, I'd be grateful if you could put this image in the root directory of your website (that's where the code looks):

Powered by WarwickBlogsGrabber


I'd like to hear what you have to say about this or any other project on the site.

If you have any comments, compliments, or suggestions feel free to get in touch and let me know.


Download the latest version using the link below.

Note that the first version uploaded here was last updated 2008-07-06. The date of any subsequent changes will be accurately reflected in the date shown in the table.

SelectionFile type iconFile nameDescriptionSizeRevisionTimeUser

View Download
A PHP script to grab and process the RSS feed for a Warwick University blog for display on an external website.  9k v. 5 23 Mar 2013, 21:51 Richard Winskill