步驟如下:
1) 下載
2) 建立名為"cache"的目錄
3) 引入simpiepie.inc (其實也只需要這個檔案)
require_once 'simplepie.inc';
4) 建立一個SimplePie物件, 就可以去資料結構裡撈了!
$feed = new SimplePie('http://feeds2.feedburner.com/moogoo');
$feed->handle_content_type(); // This makes sure that the content is sent to the browser as text/html and the UTF-8 character set (since we didn't change it).
$feed->get_permalink(); // feed's link
$feed->get_title(); // feed's title
$feed->get_description(); // feed's description
foreach ($feed->get_items() as $item) {
$item->get_permalink(); // item's link
$item->get_title(); // item's title
$item->get_description();
$item->get_date('j F Y | g:i a');
}
沒有留言:
張貼留言