simple pie get link from enclosure item in simplepie rss feed
<p>i had an item like this in a rss feed, and i wanted to grab the enclosure url, took me a while to figure this out for some reason even though the solution is quite simple. </p>
<h4>PHP</h4>
<pre><code class="php hljs"><item>
<title>title</title>
<link>https://kruxor.com/</link>
<dc:creator>
<![CDATA[ KRUXOR ]]>
</dc:creator>
<enclosure url="https://kruxor.com/logo.jpg" type="image/jpeg"/>
<category>
<![CDATA[ Cat ]]>
</category>
<description>
<![CDATA[ Text ]]>
</description>
<content:encoded>
<![CDATA[ <p>Long Text</p> ]]>
</content:encoded>
<pubDate>Thu, 29 Sep 2022 03:10:07 GMT</pubDate>
<guid isPermaLink="true">https://kruxor.com/</guid>
</item></code></pre>
<p>Just use getenclosure and then getlink rather than trying to access the object returned by the getenclosure function. </p>
<p><code>$gamenews->image = $item->getenclosure()->getlink();</code></p>
<p>..</p>