0
<guid isPermaLink="false">

<title>iphone cover 4</title>

<media:price>$35.95</media:price>

<media:thumbnail url="http://rlv.zcache.com/22.jpg"/>

<media:content url="http://rlv.zcache.com/440.jpg"/>

Above is the xml file I want to read, I can get title, media price and even Guid's isPermalink attribute. But I cannot get media:thumbnail attribute Below is my code.

foreach ($xml->channel->item as $cool)
{
    $per = $cool->guid["isPermaLink"];
    $thumb = $cool->children('media', true)->price;
    $title = $cool->title;
    $thumb = $cool->children('media', true)->thumbnail["url"];
}

How do I get media:thumbnail attribute?

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • 1
    go through this [link](http://stackoverflow.com/questions/1256796/how-to-get-the-value-of-an-attribute-from-xml-file-in-php) – rynhe Jan 03 '13 at 12:12

1 Answers1

0

Try to cycle through thumbnail attributes

foreach ($cool->children('media', true)->thumbnail as $thumb) {
   $URL = $thumb['url']
}
jose
  • 2,733
  • 4
  • 37
  • 51