Affiliates Members Login
Affiliate ID:
Password:
Forgot your
Affiliate ID/Password


SIGN UP NOW!

Our Casino Clients
Latest Casino PromotionsView our Latest Casino Promotions
Cirrus Casino
is offering bonuses of up to 250% in their Bonus Circus
click here
Cool Cat Casino
has a 100% Deposit Bonus with no playthrough restrictions!
click here
Club Player Casino
gives you an incredible 350% Bonus on your First Sign Up.
click here
Palace of Chance
is looking for the pirates treasure, find it and get 100% Bonus!
click here

Including Casino Affiliate RSS Feeds

Including casino affiliate RSS feeds in to your own pages is pretty simple with PHP and some open source libraries. The following lines show how to create HTML from RSS feeds using the popular PHP tools magpierss (fetches and parses the RSS feed) and Smarty (template engine).
It may look like overkill to use such powerful tools for such a simple task. But once installed, both give a variety of functions and reduce the self-written code to a few lines.

Here we go:

A. Preparing the Web host/Server

A current version of PHP is necessary. The following tutorial assumes that all files are placed in the folder /rssdemo on your web host.

1. Install magpierss RSS tool
I am not sure if I am allowed to add URLs here, so just Google for "magpierss" and take the first result. Follow the DOWNLOAD link and download the recent version of magpierss (0.72 as I write this).

The file comes as .tar.gz format, so if you are on a Windows PC, you will need additional software to unzip this. I think WinZip does the job, you can also use the free tool "7-zip". The first "Extract" will make a .tar-file out of the .tar.gz, the second extraction should create a folder named magpierss-0.72.

2. Install Smarty template engine
Google for "smarty" and follow the link to php.net. Download the recent version of Smarty (2.6.12 as I write this).

The file also comes as .tar.gz format, after extraction there should be a folder named Smarty-2.6.12.

3. Rename folders and move them to /rssdemo
Wherever you extracted both folders, now it is time to move them. First delete the version numbers out of the folder names. Change magpierss-0.72 to magpierss and Smarty-2.6.12 to Smarty. Move both folders into the /rssdemo folder on your local test server or upload them to your web server.

4. Smarty needs some special folders.
Please create the following folders in the /rssdemo folder:
- cache
- configs
- templates
- templates_c
The last one, templates_c, needs to have write permission for Smarty. If your web host is on Unix, set the permissions as needed (777 in the worst case, depends on server configuration).

B. A few lines of PHP for parsing and displaying the feed.

Now, with all the installation work done, we only need a few more lines of code for our task. Place the following code in a file named feed.php in the /rssdemo folder.
---------------------
<?
/* The folder where this file is located. Change to whatever you need */
$mydir = "/rssdemo"; /* Include magpierss and Smarty library */
require_once($_SERVER["DOCUMENT_ROOT"].$mydir."/Smarty/libs/Smarty.class.php");
require_once($_SERVER["DOCUMENT_ROOT"].$mydir."/magpierss/rss_fetch.inc");
/* Create a template object for further use */
$tpl = new Smarty();

/* Set folders for Smarty object. This folders have to exist on your web server (Check A.3) */
$tpl->template_dir = $_SERVER["DOCUMENT_ROOT"].$mydir.'/templates/';
$tpl->compile_dir = $_SERVER["DOCUMENT_ROOT"].$mydir.'/templates_c/';
$tpl->config_dir = $_SERVER["DOCUMENT_ROOT"].$mydir.'/configs/';
$tpl->cache_dir = $_SERVER["DOCUMENT_ROOT"].$mydir.'/cache/';

/* The URL of the feed we want to include */
$url = "http://rss.news.yahoo.com/rss/world";

/* magpierss does all the work! */
$rss = fetch_rss($url);

/* Uncomment the following line to see the object and array data returned. Good to see which other information has been processed by magpierss */
// echo "<pre>"; print_r($rss); echo "</pre>";

/* If the RSS could be parsed, add it to the template */
if ($rss) {
/* Sends the feed title to the template engine */
$tpl->assign("feedtitle",$rss->channel["title"]);
/* Sends the RSS items as an array */
$tpl->assign("items",$rss->items);
}
else {
/* RSS problem? */
$tpl->assign("feedtitle","Problem with: $url");
}

/* Fill the template file itemlist.html with the information and return it */
$feedhtml = $tpl->fetch($_SERVER["DOCUMENT_ROOT"].$mydir."/templates/itemlist.html");
/* Do with $feedhtml whatever you want */
echo $feedhtml;
?>

------------------

C. We need a template!

Smarty is a very powerful template engine which makes creating tables and lists a snap. For this demo we need a simple template that prints the name of the feed in the title and lists the items.

Copy the following lines into a file named "itemlist.html" and save it in the /rssdemo/templates folder.

------------------

{* very simple template for a table with RSS items *}
<table>
{* Show the feed title as a header in the first row of the table *}
<tr><th style="font-size: 24px; border: 1px solid black;">{$feedtitle}</th></tr>
{* loop through all items and add date, link, title and description in the following section *}
{section name=x loop=$items}
<tr><td class="rssitem" style="border: 1px solid red;">
<strong>{$items[x].pubdate}: <a href="{$items[x].link}" target="_blank">{$items[x].title}</a></strong><br>
{$items[x].description}
</td></tr>
{/section}
</table>
{* That's it. Table can be formatted using some CSS classes *}


------------------

D. Putting it all together

Now browse to the URL /rssdemo/feed.php on your web server. The feed should be displayed with some red lines around each item.

E. Serious usage

Usually you want to include the feed output somewhere into your casino affiliate page. The simplest way is the name your pages .php instead of .html and add the following line where the feed html should be displayed.


<? include "rssdemo/feed.php"?>


e.g. like this


<table>
<tr>
<td width="80%">Left column with some information</td>
<td>Right column contains the feed<br /> <? include "rssdemo/feed.php"?></td>
</tr>
</table>


If you can't or don't want to rename your existing files, you could force your web server to parse even .html-files for PHP code. If you use Apache, you could add the "AddType application/x-httpd-php .php .html" to your .htaccess. But this is another story.

I am sure I forgot some important things, so please feel free to ask. I installed both libraries and scripted and tested the PHP and template code as I wrote this on my local development server, so everything should work as expected.

Our Partners