2012-05-01 11 views
0

J'ai un flux RSS flikrphp navigation d'un flux RSS avec un espace de noms

http://api.flickr.com/services/feeds/photoset.gne?set=72157629920039099&[email protected]&lang=en-us&format=rss_200

Ici il y a un média: description, médias: miniatures etc

Je suis en train de mon mieux pour obtenir l'URL du média: vignette mais je n'ai pas de chance!

Mon code ...

$content = file_get_contents("http://api.flickr.com/services/feeds/photoset.gne?set=72157629920039099&[email protected]&lang=en-us&format=rss_200"); 

$x = new SimpleXmlElement($content); 

$ourItems = ""; 

foreach($x->channel->item as $entry) { 

    $thumbParent = $entry->children("media"); 
    $thumb   = $thumbParent->thumbnail->attributes(); 
    $thumbW  = $thumb['width']; 
    $thumbH  = $thumb['height']; 
    $thumbURL  = $thumb['url']; 

    $ourItems .= "<li>\n" 
        ."<a href='$entry->link' title='$entry->title'>\n" 
         ."<img src='" . $thumbURL . "' />\n" 
        ."</a>\n" 
       ."</li>\n"; 

} 

return $ourItems; 

S'il vous plaît quelqu'un peut me diriger dans la bonne direction - merci!

Répondre

0

Essayez d'utiliser la fonction enfants:

$thumbA = $item->children('media', true)->thumbnail->attributes(); 

<media:thumbnail url="<?php echo ($thumbA['url']); ?>" />