Using SimpleXml I read a piece of tape
<item> <title>The Justices Lay Down the Law</title><pubDate>Wed, 28 Jun 2017 14:07:05 -0500</pubDate> <fullpubdate>06/28/2017/00/00/00</fullpubdate> <description><![CDATA[ <a href="/authors/david_rivkin" data-mce-href="../../authors/david_rivkin">Rivkin</a> & <a href="/authors/lee_casey" data-mce-href="../../authors/lee_casey">Casey</a>, <span class="source">Wall Street Journal</span><br />In the travel-ban case, a high-court ‘compromise’ delivers a unanimous rebuke to political judges.]]></description><link>https://www.realclearpolitics.com/2017/06/28/the_justices_lay_down_the_law_414173.html</link><originalLink>https://t.co/y0BkZIKyc1</originalLink> <guid isPermaLink="false">100414173</guid> <category>PM Update</category> <author><![CDATA[ <a href="/authors/david_rivkin" data-mce-href="../../authors/david_rivkin">Rivkin</a> & <a href="/authors/lee_casey" data-mce-href="../../authors/lee_casey">Casey</a>, Wall Street Journal]]></author><media:content url="https://assets.realclear.com/images/41/419326_1_.jpg" type="image/jpeg" height="190" width="250" /> <media:thumbnail url="https://assets.realclear.com/images/41/419326_3_.jpg" height="60" width="90" /> <media:title>The Justices Lay Down the Law</media:title> </item> $content_data = @file_get_contents($this->data_source); $xmlDataArray = new \SimpleXmlElement($content_data); foreach($xmlDataArray->channel->item as $nextXmlRow) { dump($nextXmlRow); dump($nextXmlRow->media); dump($nextXmlRow->author); And I get the output:
SimpleXMLElement {#368 ▼ +"title": "The Justices Lay Down the Law" +"pubDate": "Wed, 28 Jun 2017 14:07:05 -0500" +"fullpubdate": "06/28/2017/00/00/00" +"description": SimpleXMLElement {#373} +"link": "https://www.realclearpolitics.com/2017/06/28/the_justices_lay_down_the_law_414173.html" +"originalLink": "https://t.co/y0BkZIKyc1" +"guid": "100414173" +"category": "PM Update" +"author": SimpleXMLElement {#374} } SimpleXMLElement {#370} SimpleXMLElement {#370 ▼ +0: SimpleXMLElement {#377} } The media and author nodes are empty, although you can see in the source code that they matter ... How to get the value of these fields? Is there something better than SimpleXml?