This is a re-published (& slightly updated) article, orginaly published on my first blog The Journal (now offline, redirecting here)

*cue Tim Shaw voice-over* “Have you ever wanted to have the latest news on the persecution of Christians around the world on your website? Well now you can!

ahem…

I’ve written a perl script to extract the RSS file from the Voice of the Martyrs website.

This takes the rss file and parses it using the XML::RSS module. So obviously you will need to be running a server that has both perl and the XML module installed. By default the script creates a div that looks like this (using the default css file), but it can be edited to change the HTML produced.

Anyway, here’s the code:
<?php require($CODE_INCLUDE_PATH."vomheadlines.txt"); ?>

or download the files [vomheadlines.pl] [vomheadlines.css]

When the script is run, it creates a file in the location specified by the $outputFile variable. If you put this into your includes directory and include it in your web pages, the headlines will appear. To make them regularly update, make a cron job for it. Once a day should be regularly enough.

Instructions:

  1. Copy and paste the above text (or download the file & open it) using a text editor.
  2. Change the location of $outputFile to wherever you keep your include files (or make a directory for it if you don’t have one)
  3. Save the file to your webserver (probably in the cgi-bin) & chmod it to 755 (set the permissions to execute)
  4. Run the script to create the output file from the shell.
  5. Set cron to run once a day (0 0 * * * /path/to/vomheadlines.pl)
  6. Include in your webpage & set the style sheet (or @include the default one given above in your current style sheet)