ajouter un flux xml pour légion de aion [Réglé]
ReidLos Membre non connecté
-
Modérateur
- Voir le profil du membre ReidLos
- Inscrit le : 27/02/2009
- Site internet
- Groupes :
-
Equipe Développement
Reprise du message précédent
Code PHP :
<?php define('PATH_TO_ROOT', '.'); require_once PATH_TO_ROOT . '/kernel/begin.php'; define('TITLE', 'Légion'); require_once PATH_TO_ROOT . '/kernel/header.php'; $curl = curl_init(); $url = "http://myaion.foohey.net/xml/legion?lang=&serverID=40&legionID=3385&commit=Envoyer"; curl_setopt($curl,CURLOPT_URL,$url); curl_setopt($curl,CURLOPT_RETURNTRANSFER,true); $contenu = curl_exec($curl); $xml = new simpleXMLElement($contenu); echo ' Infos serveur <br><br>'; echo $xml->name. '<br>'; echo $xml->server. '<br>'; echo $xml->faction. '<br>'; echo $xml->level. '<br>'; echo $xml->rank. '<br>'; echo $xml->contrib_points. '<br>'; echo $xml->total_members. '<br>'; echo '<br>'; echo 'infos membres<br><br>'; echo '<TABLE BORDER=1> <TD>pseudo </TD><TD>rang </TD><TD>level </TD><TD>class </TD></TR>'; foreach($xml->members->member as $i) { $name = $i->name; $rang = $i->rang; $level = $i->level; $class = $i->class; echo '<TR> <TD> <P><CENTER>'.$name.'</CENTER> </TD><TD> <P><CENTER>'.$rang.'</CENTER> </TD><TD> <P><CENTER>'.$level.'</CENTER> </TD><TD> <P><CENTER>'.$class.'</CENTER> <TR>' ; } echo '</TABLE>' ; curl_close($curl); require_once PATH_TO_ROOT . '/kernel/footer.php'; ?>
Édité par ReidLos Le 23/12/2009 à 19h41
winny33 Membre non connecté
Booster Fuzil
-
Booster Fuzil
- Voir le profil du membre winny33
- Inscrit le : 15/10/2009
ReidLos Membre non connecté
-
Modérateur
- Voir le profil du membre ReidLos
- Inscrit le : 27/02/2009
- Site internet
- Groupes :
-
Equipe Développement
winny33 Membre non connecté
Booster Fuzil
-
Booster Fuzil
- Voir le profil du membre winny33
- Inscrit le : 15/10/2009
Holgrabus Membre non connecté
Booster Fronde
-
Booster Fronde
- Voir le profil du membre Holgrabus
- Inscrit le : 22/02/2010
.http://www.aiondatabase.com/xml/legions/2182-41.xml
En plus, je voudrais mettre des conditions comme ci-dessous:
Code :
<?php
$curl = curl_init();
$url = "http://myaion.foohey.net/xml/legion?lang=&serverID=41&legionID=2182&commit=Envoyer";
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
$contenu = curl_exec($curl);
$xml = new simpleXMLElement($contenu);
echo '<center><b><font size="3">';
echo $xml->name. '</font></b></center><br><br>';
echo '<table width="100%"><tr><th width="20%"><font style="color:#b8bbbf">Niveau:</font> <font style="color:#4c8fdf">';
echo $xml->level. '</font></th>';
echo '<th width="20%"><b><font style="color:#b8bbbf">Rang de Legion:</font> <font style="color:#4c8fdf">';
echo $xml->rank. '</font></th>';
echo '<th width="40%"><b><font style="color:#b8bbbf">Points de contribution:</font> <font style="color:#4c8fdf">';
echo $xml->contrib_points. '</font></th>';
echo '<th width="20%"><b><font style="color:#b8bbbf">Membres:</font> <font style="color:#4c8fdf">';
echo $xml->total_members. '</font></th></tr></table>';
echo '<br><br>';
echo '<table width="100%"><tr><th width="35%"><center><font size="3">Membres de la Legion</font></center></th><th width="25%"><center><font size="3">Rang</font></center></th><th width="15%"><center><font size="3">Niveau</font></center></th><th width="25%"><center><font size="3">Classe</font></center></th></tr></table>';
foreach($xml->members->member as $i) {
$name = $i->name;
$rang = $i->rang;
$level = $i->level;
$class = $i->class;
if ($rang=='General de Brigade') { $img='http://static.fr.aiononline.com/aion/common/grade/master.gif'; }
if ($rang=='Centurion') { $img='../pictures/centurion.gif'; }
if ($rang=='Legionnaire') { $img='http://static.fr.aiononline.com/aion/common/grade/officer.gif'; }
if ($class=='Gladiateur') { $image='http://static.fr.aiononline.com/aion/common/class/class_1.gif'; }
if ($class=='Clerc') { $image='http://static.fr.aiononline.com/aion/common/class/class_10.gif'; }
if ($class=='Assassin') { $image='http://static.fr.aiononline.com/aion/common/class/class_4.gif'; }
if ($class=='Sorcier') { $image='http://static.fr.aiononline.com/aion/common/class/class_7.gif'; }
if ($class=='Aede') { $image='http://static.fr.aiononline.com/aion/common/class/class_11.gif'; }
if ($class=='Spiritualiste') { $image='http://static.fr.aiononline.com/aion/common/class/class_8.gif'; }
if ($class=='Templier') { $image='http://static.fr.aiononline.com/aion/common/class/class_2.gif'; }
if ($class=='Rodeur') { $image='http://static.fr.aiononline.com/aion/common/class/class_5.gif'; }
if ($class=='Mage') { $image='http://static.fr.aiononline.com/aion/common/class/class_6.gif'; }
if ($class=='Pretre') { $image='http://static.fr.aiononline.com/aion/bbs/emoticon/class/class_9.gif'; }
if ($class=='Eclaireur') { $image='http://static.fr.aiononline.com/aion/bbs/emoticon/class/class_3.gif'; }
if ($class=='Guerrier') { $image='http://static.fr.aiononline.com/aion/bbs/emoticon/class/class_0.gif'; }
echo '<table width="100%"><tr><td width="35%"><font style="color:#499a80">'.$name.'</font></td><td width="25%"><img src="'.$img.'" /><font style="color:#b8bbbf"> '.$rang.'</font></td><td width="15%"><center><font style="color:#b8bbbf">'.$level.'</font></center></td><td width="25%"><img src="'.$image.'" /><font style="color:#b8bbbf"> '.$class.'</font></td></tr></table>';
}
curl_close($curl);
?>
J'ai fais des petites modifications pour que ca donne un peu comme sur le site officiel de ncsoft, et je voudrais retrouver un peu la même chose si possible.
Édité par Holgrabus Le 23/02/2010 à 00h44
Holgrabus Membre non connecté
Booster Fronde
-
Booster Fronde
- Voir le profil du membre Holgrabus
- Inscrit le : 22/02/2010
Holgrabus Membre non connecté
Booster Fronde
-
Booster Fronde
- Voir le profil du membre Holgrabus
- Inscrit le : 22/02/2010
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie