Voila je galère de nouveau dans un XML pour récupérer les donnés:
J'essai de récupérer les infos du xml de la sorte, mais rien ne marche.... je fait fausse route ?
$flux = simplexml_load_file('datafeed_325105.xml'); // Source du flux.xml
set_time_limit(0);
// On entre les entrees en bdd
function multiexplode ($delimiters,$string) {
$ready = str_replace($delimiters, $delimiters[0], $string);
$launch = explode($delimiters[0], $ready);
return $launch;
}
foreach ($flux->prod as $item) {
// Récupération des données en fonction du tagname du XML
$number = addslashes($item->pId);
$categorie = addslashes($item->cat);
$prix = addslashes($item->price->buynow);
$titre = addslashes($item->text->name);
$description = addslashes($item->text->desc);
echo $number.'<br>';
echo $categorie.'<br>';
echo $prix.'<br>';
echo $titre.'<br>';
Voici l'exemple du contenu d'un article du XML:
<prod id="3803121649" lang="fr"><brand/>
<cat><mCat>FILM</mCat></cat>
<price curr="EUR"><buynow>8.50</buynow><store>0.00</store></price>
<text>
<name>ARCTIQUE</name>
<desc>ici un texte</desc>
</text>
<uri>
<awTrack>http://www.awin1.com/pclick.php?p=3803121649&a=325105&m=7430</awTrack>
<awImage>http://images.productserve.com/noimage.gif</awImage>
<mImage>https://static.ticketmaster.fr/static/images/vignettes/a_271920.gif</mImage>
<mLink>http://www.awin1.com/pclick.php?p=3803121649&a=325105&m=7430</mLink>
</uri>
<vertical id="6" name="Tickets">
<eventDate>30/03/2017 12:30</eventDate>
<eventLocationCity>PARIS</eventLocationCity>
<eventLocationCountry>FRANCE</eventLocationCountry>
<eventLocationRegion>75019</eventLocationRegion>
<primaryArtist>GEODE</primaryArtist>
<venueAddress>26, avenue Corentin Cariou</venueAddress>
<venueName>La Geode</venueName>
</vertical>
<pId>271920</pId></prod>