記錄一下用 php 抓取 wordpress 的 RSS 的方法。
$rss_feed = simplexml_load_file("http://superhero.wingzero.tw/feed/");
$xml = $rss_feed->channel->item;
//用 var_dump() 可以看到完整的結構
//var_dump($xml);
//跑迴圈
foreach( $xml as $row )
{
/ Load the entry publish time
$dtime = date("D jS M, Y", strtotime(strtok($row->pubDate, 'T')));
// Load the link of each blog entry
$link = $row->link;
/* Display the contents (use your own imaginations here =).) */
$title=$row->title;
}
試著去 parse xml 就可以了。