逆引きrhaco(?)3: Feedを取得する
一番簡単な方法は
Rhaco::import('tag.feed.FeedParser'); $feed = FeedParser::read('http://url/To/feed');
です。注意点は
○必ずRSS2.0形式になること
○RSS2.0形式で通常使われる項目(channel項目としてtitle,link,description,image,cloud,textinput、item項目としてtitle,link,description,author,guid,source,comments,pubdate,enclosure,category)以外は取得されないこと。(例えばdc:subjectなどの項目は取得できません。)
○RSS2.0形式の制限があること。(例えばitemのlink項目は複数取得できません)
です。
channel無しでitemのみ必要な場合は
$items = FeedParser::getItem('http://url/To/feed');
[便利な機能]
http://url/To/feedの代わりにhttp://url/To/htmlとすると、指定したHTMLファイル内にがある場合、その中にあるフィードを読み込んでくれます。