PHP - RSS ~ Feedcreator

還蠻好用的~~~~~~~~要用PHP產生RSS的可以用用看


example:
----------------------------------------------------------------------------------------------
include "include/feedcreator.class.php";

$feed = new UniversalFeedCreator();
$feed->useCached();
$feed->title="xxxxxxxx";
$feed->description="aaaaaaaaaa";
$feed->link="http://www.xxxxxxxx.com.tw/";

$sql = "SELECT * FROM xxxxxxx ORDER BY id DESC LIMIT 100";
$r = db_query($sql);
while($x = db_fetch($r)){

$item = new FeedItem();
$item->title = 'ttttttttttttttt';
$item->link = 'lllllllllllllllllllll';
$item->guid = "http://www.xxxxxxxxx.com.tw/".$x['id'];
$item->description = $x['description'];
$item->source = "http://www.xxxxxxxxxxx.com.tw";
$item->author = "GGYY";
$item->category = "normal";
$feed->addItem($item);

}

if ($_GET['type'] == 'atom') {
$feed->outputFeed("ATOM1.0");
//$feed->saveFeed("ATOM1.0", "news/feed.xml");
} else if ($_GET['type'] == 'atom0'){
$feed->outputFeed("ATOM0.3");
} else if ($_GET['type'] == 'rss2.0'){
$feed->outputFeed("RSS2.0");
} else {
$feed->outputFeed("RSS");
}

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

source
http://feedcreator.org/

沒有留言: