<?php
$feed_data = file("../news-archive.html");
foreach ($feed_data as $line) {
	if (preg_match("#<a href=\"http://www.blindbetpoker.com/([^\s]+)\">#", $line, $regs)) {
		$match_title = 1;
		$doc = $regs[1];
	} elseif ($match_title == 1) {
		preg_match("#^\s+(.*)</a>#", $line, $regs);
		$title = $regs[1];
		$match_title = 0;
		$match_date = 1;
	} elseif ($match_date == 1) {
		preg_match("#^\s+(.*) </td>#", $line, $regs);
		$date = $regs[1];
		$match_date = 0;
		if ($doc and $title and $date) {
			$items[] = array($doc, $title, $date);
		}
		$doc = ''; $title = ''; $date = '';
	}
}
header("Content-type: text/xml");
echo '<?xml version="1.0" encoding="ISO-8859-1"?>';
echo "\n<rss version=\"2.0\">\n";
echo "<channel>\n";
echo "<title>Latest Online Poker News - Blind Bet Poker</title>\n";
echo "<link>http://www.blindbetpoker.com/</link>\n";

foreach ($items as $item) {
	list($doc, $title, $date) = $item;
	$title = stripslashes($title);
	echo "<item>\n";
	echo "<title>$title</title>\n";
	echo "<link>http://www.blindbetpoker.com/$doc</link>\n";
	echo "<pubDate>$date</pubDate>\n";
	echo "</item>\n";
}

echo "</channel>\n";
echo "</rss>";
?>
