メインコンテンツまでスキップ
Version: Fegg 5.x(開発版)

RSS::fetchAll

Fetch all entries or specified number of entries of RSS feed

Description​

public array RSS::fetchAll( [ int $max = 0 ] )

Returns the remaining entries (see Entry data) as an array.

Arguments​

NameData typeDefaultRemarks
$maxint0Maximum number of entries / 0: all the entries

Example​

Controller
use Fegg\Tool\RSS;

$rss = new RSS('https://example.com/feed');
$posts = $rss->fetchAll(5);

foreach ($posts as $post) {
// $post['title'], $post['link'], $post['datetime'] ...
}