-
Notifications
You must be signed in to change notification settings - Fork 8
Simple, leveraging default options
Ryan Parman edited this page Dec 29, 2017
·
2 revisions
Works as of commit 3ff70d6926.
use GuzzleHttp\Psr7;
use SimplePie\SimplePie;
// Instantiate SimplePie.
$simplepie = new SimplePie();
// Pass a PSR-7 stream to SimplePie for parsing.
$stream = Psr7\stream_for(file_get_contents(__DIR__ . '/releases.atom'));
// Specifically parses XML.
$parser = $simplepie->parseXml($stream, true);
// Reference the top-level feed object
$feed = $parser->getFeed();
// Use familiar syntax to read the data you care about.
echo $feed->getTitle();
foreach ($feed->getItems() as $item) {
echo $item->getTitle();
}
Project Information
Usage
Internals
Contributing