Reputation: 61
I'm trying to use SimplePie and PHP to grab the url value from the tag. An example of the RSS code is:
<item>
<title>Headline goes here</title>
<link>https://sampledomain.com/index.html</link>
<description><![CDATA[ Body copy is here. ]]></description>
<dc:creator>Migraine Team</dc:creator>
<pubDate>Mon, 29 Jul 2019 16:00:01 +0000</pubDate>
<media:content url="https://sampledomain.net/imagetograb.jpg" medium="image"/>
<guid>https://sampledomain.com/index.html</guid>
</item>
I loop through the items…
foreach ($feed->get_items() as $item) {
}
but I'm uncertain how to grab the url value from the tag.
Upvotes: 2
Views: 1134
Reputation: 61
This is what eventually worked for me:
foreach ($feed->get_items() as $item) {
$item->get_item_tags('http://search.yahoo.com/mrss/','content')[0]['attribs']['']['url'];
}
Upvotes: 4