memo.xight.org

日々のメモ

MagpieRSS

Summary

  PHPで使えるRSSパーサー

サンプル

<?php
	require_once 'rss_fetch.inc';
	$url = 'http://www.hyuki.com/yukiwiki/wiki.cgi?RssPage';
	$rss = fetch_rss($url);
	$title = $rss->channel['title'];
	$title = mb_convert_encoding($title, "SJIS", "auto");
	echo "<h2>$title</h2>\n";
	echo "<ul>\n";
	foreach ($rss->items as $item ) {
		$title = $item[title];
		$title = mb_convert_encoding($title, "SJIS", "auto");
		$url   = $item[link];
		echo "<li><a href=\"$url\">$title</a></li>\n";
	}
	echo "</ul>\n";
?>

Reference

  YukiWiki - MagpieRSS
  http://www.hyuki.com/yukiwiki/wiki.cgi?MagpieRSS