Je parse un flux xml avec SimpleXML.
J'ai souhaite récupérer une chaine de caractère avec des caractères spéciaux dans un id de session avec la fonction urlencode.
Ca marche avec ce code mais j'ai un problème, ça m'affiche toujours la dernière catégorie vu que c'est dans une boucle 'Si' alors que je voudrais que ça change en fonction du lien cliqué.
Voici le code :
Code : Tout sélectionner
$xml_cat = simplexml_load_file('http://gsm-sonnerie1.magikmobile.com/catalog_v1_0.asmx/GetCategories?culture=fr-FR&productType=Hi-fi+cd+originale');
for($i=0; $i<=50; $i++) {
$_SESSION['nomc']=urlencode((string)$xml_cat->string[$i]);
echo '<a href="contenu/cat.php5?'.urlencode($xml_cat->string[$i]).'">'.utf8_decode((string)$xml_cat->string[$i]).'</a>';
}Autrement, je voudrais savoir s'il est possible de récupérer un produit spécifique définit par un numéro dans le Product Id du flux XML avec pour paramètre entrée un numéro préalablement définit.
Voici un extrait du flux XML :
Code : Tout sélectionner
<ArrayOfProduct xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.sonnerie.com">
<Product Id="748456">
<Localization>http://content.mkmb.net/p.ashx?id=748456&f=56&t=.mp3</Localization>
<Caption>Parle à ma main</Caption>
<Interpret>Fatal Bazooka</Interpret>
</Product>
<Product Id="780024">
<Localization>http://content.mkmb.net/p.ashx?id=780024&f=56&t=.mp3</Localization>
<Caption>Don't Stop The Music</Caption>
<Interpret>Rihanna</Interpret>
</Product>Merci pour votre aide