Build RSS Channel

gptsven

New Member
Messages
253
Reaction score
5
Points
0
PHP:
<?php 

// CODE MAY BE SPREAD , leave in credits
// Programmer : Contagious Aka Synbitz 
// used on : http://www.webhost-choice.com
include_once('../config.php');
include_once('../Functions/General.php');
header("Content-Type: application/xml; charset=UTF-8");
$query = "SELECT *,DATE_FORMAT(date_added,'%a, %d %b %Y %T' ) AS added FROM hosts ORDER BY date_added DESC";
DB_CONNECT($DB_FreeHosting,$DB_Host,$DB_User,$DB_Password);
$result = mysql_query($query) or die(mysql_error());
DB_DISCONNECT();

echo '<?xml version="1.0" ?>';
echo '<rss version="2.0">';
echo '<channel>';
echo '<title>Webhost-Choice.com : Receive Updates on Free web hosting</title>';
echo '<description>This feed will keep you updated on recently added free hosts</description>';
echo '<link>http://www.webhost-choice.com</link>';
echo '<image>';
echo '<title>Webhost-choice.com</title>';
echo '<width>200</width>';
echo '<height>200</height>';
echo '<link>http://www.webhost-choice.com</link>';
echo '<url>http://www.webhost-choice.com/Graphics/Layout/Header-Logo.png</url>';
echo '</image>';
while ($data = mysql_fetch_assoc($result))
{
echo '<item>';
echo '<title>'.$data['name'].'</title>';
echo '<description>Added on '.$data['added'].'</description>';
echo '<link>http://www.webhost-choice.com/freehost-package-details/'.$data['id'].'-'.$data['name'].'/</link>';
echo '</item>';
}

echo '</channel>';
echo '</rss>';

?>
Result : http://www.webhost-choice.com/RSS/freehostsrss.php

Modify a couple of things and you get what ya need, your own little rss channel for any of your news pages/whatever lol
 
Top