Get enclosure img url from rss feed
I have a problem with an rss feed in php. I want do get the img-url from "enclosure" but it´s not working. My code just now: $rss = simplexml_load_file($url); $i = 0; if($rss) { $items = $rss->channel->item; foreach($items as $item) { $title = $item->title; $link = $item->link; $published_on = $item->pubDate; $phpDate = strtotime($published_on); $enclosure = $item['enclosure'][0]['url']; From the RSS: <enclosure url="http://www.svenskafans.com/image/7/141433/Snalla-Pelle-stanna-i-Gefle.jpg" lenght="51265" type="image/jpeg" /> Important to note is that sometimes there is not enclosure-tag with