For example, in PHP, a way to parse an RSS feed might be:
<?php $rss = simplexml_load_file('http://blog.wordpress_site.com/feed/'); {{ rss }} foreach ($rss->channel->item as $item) { echo $item->title; echo $item->link; echo $item->description; echo $item->guid; } ?>
How to do it on Twig?
UPDATE . Thanks to the answer, I got it. Now he gets this by element, but not some fields, such as an image, category or message text:
SimpleXMLElement {#955 ▼ +"title": "Website. Description of the website" +"link": "http://blog.website.com/liktothepost" +"pubDate": "Fri, 17 Feb 2017 07:56:43 +0000" +"category": SimpleXMLElement {#1131} +"guid": "http://blog.website.com/?p=400" +"description": SimpleXMLElement {#953} }
source share