J'essaye de récupérer la valeur présante dans la balise "<media:player" dans un flux RSS dailymotion, mais je n'y arrive pas:
Ici la valeur à récupérer serait :
<![CDATA[<iframe frameborder="0" width="480" height="270" src="http://www.dailymotion.com/embed/video/xlm2ra"></iframe>]]>
Le flux RSS en question :
Code : Tout sélectionner
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:media="http://search.yahoo.com/mrss" xmlns:dm="http://www.dailymotion.com/dmrss">
<channel>
<title>PSG - Vidéos les plus récentes - Dailymotion</title>
<link>http://www.dailymotion.com/user/PSG/1</link>
<description><![CDATA[Bienvenue sur la chaine officielle du Paris Saint-Germain sur Dailymotion !]]></description>
<itunes:subtitle>Dailymotion - Les Vidéos Les Plus Récentes De PSG</itunes:subtitle>
<itunes:summary>Bienvenue sur la chaine officielle du Paris Saint-Germain sur Dailymotion !</itunes:summary>
<itunes:owner>
<itunes:name>Dailymotion</itunes:name>
<itunes:email>[email protected]</itunes:email>
</itunes:owner>
<itunes:author>PSG</itunes:author>
<itunes:image href="http://www.dailymotion.com/images/dailymotion_itunes.jpg"/>
<itunes:explicit>no</itunes:explicit>
<itunes:category text="TV & Film" />
<language>en-US</language>
<lastBuildDate>Wed, 19 Oct 2011 21:59:44 +0200</lastBuildDate>
<image>
<url>http://www.dailymotion.com/images/dailymotion.jpg</url>
<title>PSG - Vidéos les plus récentes - Dailymotion</title>
<link>http://www.dailymotion.com/user/PSG/1</link>
<width>400</width>
<height>144</height>
</image>
<dm:link rel="uql" href="http://www.dailymotion.com/rss/user/PSG/1" type="application/rss+xml"/>
<dm:link rel="sort_by_visited-week" title="Les +Vues" href="http://www.dailymotion.com/rss/visited-week/user/PSG/1" type="application/rss+xml"/>
<dm:link rel="sort_by_rated-week" title="Les mieux notées" href="http://www.dailymotion.com/rss/rated-week/user/PSG/1" type="application/rss+xml"/>
<dm:link rel="next" href="http://www.dailymotion.com/rss/user/PSG/2" type="application/rss+xml"/>
<dm:link rel="nextUql" href="http://www.dailymotion.com/rss/user/PSG/2" type="application/rss+xml"/>
<item>
<title>N. Al-Khelaifi rencontre les jeunes</title>
<link>http://www.dailymotion.com/video/xlm2ra_n-al-khelaifi-rencontre-les-jeunes_sport</link>
<description><![CDATA[<a href="http://www.dailymotion.com/video/xlm2ra_n-al-khelaifi-rencontre-les-jeunes_sport"><img align="right" width="120" height="90" src="http://static2.dmcdn.net/static/video/249/103/36301942:jpeg_preview_medium.jpg?20111014170521" style="border: 2px solid #B9D3FE;"></a><p>Nasser Al-Khelaïfi, accompagné par Leonardo, Claude Makelele, Alain Roche, Antoine Kombouaré et Mamadou Sakho, a rencontré les jeunes des centres de préformation et de formation du PSG à Verneuil (78).</p><p>Auteur : <a href="http://www.dailymotion.com/PSG"><img src="http://static2.dmcdn.net/static/user/400/988/37889004:avatar_medium.jpg?20110831155353" width="80" height="80" alt="avatar"/>PSG</a><br />Tags : <a href="http://www.dailymotion.com/tag/PSG">PSG</a> <a href="http://www.dailymotion.com/tag/FOOT">FOOT</a> <br />Envoyé : 11 octobre 2011<br />Note :0.0<br />Votes :0<br /></p>]]></description>
<author>[email protected] (PSG)</author>
<itunes:author>PSG</itunes:author>
<itunes:explicit>no</itunes:explicit>
<itunes:summary>Nasser Al-Khelaïfi, accompagné par Leonardo, Claude Makelele, Alain Roche, Antoine Kombouaré et Mamadou Sakho, a rencontré les jeunes des centres de préformation et de formation du PSG à Verneuil (78).</itunes:summary>
<itunes:subtitle>Nasser Al-Khelaïfi, accompagné par Leonardo, Claude Makelele, Alain Roche, Antoine Kombouaré et Mamadou Sakho, a rencontré les jeunes des centres de préformation et de formation du PSG à Verneuil (78).</itunes:subtitle>
<dm:videorating>0.0</dm:videorating>
<dm:videovotes>0</dm:videovotes>
<dm:link rel="uql" href="http://www.dailymotion.com/rss/video/xlm2ra_n-al-khelaifi-rencontre-les-jeunes_sport" type="application/rss+xml"/>
<dm:link rel="userProfile" href="http://www.dailymotion.com/rss/PSG" type="application/rss+xml"/>
<dm:views>1075</dm:views>
<dm:comments>0</dm:comments>
<dm:favorites>1</dm:favorites>
<dm:id>xlm2ra</dm:id>
<dm:author>PSG</dm:author>
<dm:loggerURL>http://www.dailymotion.com/logger/video/access/xlm2ra?session_id=&referer=&country=FR&lon=2.3333000000000&lat=48.8667000000000&key=1x3eg4ugtl1gccmc8ltc54o&v=4e9f55f8&i=bca5d818&h=a1e499d9e45171e303abec9169bc0d8c</dm:loggerURL>
<dm:authorAvatar>http://static2.dmcdn.net/static/user/400/988/37889004:avatar_medium.jpg?20110831155353</dm:authorAvatar>
<dm:relativeDate>envoyé il y a 1 semaine</dm:relativeDate>
<dm:channels>sport</dm:channels>
<pubDate>Tue, 11 Oct 2011 18:25:38 +0200</pubDate>
<guid>http://www.dailymotion.com/video/xlm2ra_n-al-khelaifi-rencontre-les-jeunes_sport</guid>
<media:title>N. Al-Khelaifi rencontre les jeunes</media:title>
<media:credit>PSG</media:credit>
<media:thumbnail url="http://static2.dmcdn.net/static/video/249/103/36301942:jpeg_preview_large.jpg?20111014170521" height="240" width="320" />
<media:player url="http://www.dailymotion.com/video/xlm2ra_n-al-khelaifi-rencontre-les-jeunes_sport" height="270" width="480"><![CDATA[<iframe frameborder="0" width="480" height="270" src="http://www.dailymotion.com/embed/video/xlm2ra"></iframe>]]></media:player>
<media:group>
<media:content url="http://www.dailymotion.com/embed/video/xlm2ra" type="text/html" duration="201" width="480" height="270"/>
<media:content url="http://www.dailymotion.com/swf/video/xlm2ra" type="application/x-shockwave-flash" duration="201" width="480" height="270"/>
</media:group>
<itunes:keywords>PSG, FOOT</itunes:keywords>
<media:category label="PSG">PSG</media:category>
<media:category label="FOOT">FOOT</media:category>
</item>
</channel>
</rss>Code : Tout sélectionner
<?php
if($flux = simplexml_load_file('http://tutodev.fr/dailymotion.xml')){
foreach ($flux->channel->item as $donnee) {
$cdm = $donnee->children('http://search.yahoo.com/mrss');
echo "<pre>";
var_dump($cdm);
echo "</pre>";
}
}
?>
Code : Tout sélectionner
object(SimpleXMLElement)[5]
public 'title' => string 'N. Al-Khelaifi rencontre les jeunes' (length=35)
public 'credit' => string 'PSG' (length=3)
public 'thumbnail' =>
object(SimpleXMLElement)[7]
public 'player' =>
object(SimpleXMLElement)[8]
public 'group' =>
object(SimpleXMLElement)[9]
public 'content' =>
array
0 =>
object(SimpleXMLElement)[10]
...
1 =>
object(SimpleXMLElement)[11]
...
public 'category' =>
array
0 => string 'PSG' (length=3)
1 => string 'FOOT' (length=4)
Merci beaucoup