I'm creating a php script which uses a lot of rss sources. It puts the rss feeds in the database. There are multiple ways a thumbnail/image is put in an xml file. I have a problem with one specific way.
When an xml file contains something like this: Source
...
<media:content type="image/jpeg" url="http://static3.hln.be/static/photo/2015/1/8/6/20150405151722/crop_7613016.jpg">
<media:thumbnail url="http://static3.hln.be/static/photo/2015/1/8/6/20150405151722/crop_7613016.jpg"/>
</media:content>
...
For some reason it looks like MagPie doesn't get that element. If I var_dump that item it looks like this:
...
["media"]=> array(1) { ["content"]=> string(1) " " } ["content"]=> string(1) " "
...
Anyone an idea how I can extract the thumbnail element? Thanks in advance.
UPDATE - (some example code):
$rss = fetch_rss('http://www.hln.be/rss.xml');
foreach ($rss->items as $item )
{ //loop through rss feed
var_dump($item); //the var_dump without media elements
return $array = $arrayName = array(
'title' => $item['title'],
'url' => $item['link'],
...);
putDataInDatabase(); //put everything in the database
}
A more full look at the var_dump
array(10) { ["title"]=> string(62) "Isinbayeva ..."" ["link"]=> string(23) "http://s.hln.be/2276986" ["description"]=> string(141) "Yelena Isinbayeva ..." ["pubdate"]=> string(29) "Sun, 05 Apr 2015 13:06:00 GMT" ["author"]=> string(8) "redactie" ["guid"]=> string(23) "http://s.hln.be/2276986" ["media"]=> array(1) { ["content"]=> string(1) " " } ["content"]=> string(1) " " ["summary"]=> string(141) "Yelena Isinbayeva wil... " ["date_timestamp"]=> int(1428239160) }