0
votes

The BBC RSS feed has image in a special tag:

<media:content>
<media:thumbnail url="http://ichef.bbci.co.uk/wsimagechef/ic/106x60/ats/worldservice/assets/images/2014/07/09/140709111605_gaza_144x81_reuters_nocredit.jpg" width="106" height="60">
<img alt="" width="106" height="60" src="http://ichef.bbci.co.uk/wsimagechef/ic/106x60/ats/worldservice/assets/images/2014/07/09/140709111605_gaza_144x81_reuters_nocredit.jpg"/>
</media:thumbnail>
<media:thumbnail url="http://wscdn.bbc.co.uk/worldservice/assets/images/2014/07/09/140709111605_gaza_144x81_reuters_nocredit.jpg" width="144" height="81">
<img alt="" width="144" height="81" src="http://wscdn.bbc.co.uk/worldservice/assets/images/2014/07/09/140709111605_gaza_144x81_reuters_nocredit.jpg"/>
</media:thumbnail>
</media:content>

I don't know how to access the image src in the feed. I tried:

$t = $feed->get_items();
print_r($t[2]->get_item_tags("http://search.yahoo.com/mrss","XXXX"));

where XXXX I tried content, img, media, thumbnail, media:thumbnail, but the print_r does not give any output. This the feed link

I use the latest version of SimplePie 1.3.1

1

1 Answers

0
votes

I've never used SimplePie so I don't know how much help this will be, but perhaps it points you in the right direction.

The top of the feed shows xmlns="http://www.w3.org/2005/Atom", which is not the namespace in your function call. This correlates to the SimplePie constant SIMPLEPIE_NAMESPACE_ATOM_10. Perhaps changing your code to the following will help.

print_r($t[2]->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, "XXXX"));

Otherwise I suggest reading through the documentation to find a way of getting attributes from tags. This page looks like a good starting point.