I am trying to read XML feed using simplexml_load_file function then reading each element
foreach ($source_xml->channel->item as $rss) {
$title = $rss->title;
$image = $rss->children('media')->thumbnail->attributes()->url;
}
<item>
<media:thumbnail url="a.abcnews.com/images/US/…; width="384" height="288" credit="@TJReazor"/>
<media:keywords>1</media:keywords>
<title>
<![CDATA[ 5 Dead as Tornadoes Strike Dallas Area ]]>
</title>
<link>
<![CDATA[ abcnews.go.com/US/death-toll-reaches-severe-storms-south/… ]]>
</link>
<guid>
<![CDATA[ abcnews.go.com/US/death-toll-reaches-severe-storms-south/… ]]>
</guid>
<category>US</category>
</item>
But I am not sure how to read this element because it does not have closing tag as well as it has many attributes like url, width etc..
<media:thumbnail url="a.abcnews.com/images/US/…; width="384" height="288" credit="@TJReazor"/>
So, please let me know if anyone has tried to parse this using simple xml in PHP