Page 1 sur 1

SimpleXML - Je n'y arrive pas :(

Posté : 31 août 2007, 22:27
par RekinMalad
Bonjour à tous.

Pour interpreter les commandes coté PHP d'un XMLSocket, j'avais pondu ce script:
<?php
$command = '<test machin="cool" machine="pascool">Trux</test>';
$str = <<<XML
$command
XML;
$commande = Array();
$to_command = explode("<", $command);
$to_command = explode(" ", $to_command[1]);
$commande['name'] = $to_command[0];
echo $commande['name'];
$xml = simplexml_load_string($str);
foreach($xml->test[0]->attributes() as $a => $b) {
        $commande[$a] = $b;
}
$commande['value'] = $xml->test;
echo "<pre>";
printf($commande);
// je ne me souviens plus si c'est printf ou printr qui affiche joliement les array
echo "</pre>";
?>
Et la, ce bougre me sort:
Fatal error: Call to undefined function: simplexml_load_string() in c:\program files\easyphp1-8\www\tests.php on line 11

On m'a dit qu'il fallait inclure ma classe et l'initialiser, mais je ne sais pas du tout comment faire ...
... je m'étais aidé de ces pages pour pondre ce script...


Si on pouvait m'aider, ca serait sympa :(


Merci d'avance ... !

Posté : 01 sept. 2007, 00:28
par Ryle
Fatal error: Call to undefined function: simplexml_load_string()
:arrow: Erreur fatale : appel d'une fonction qui n'est pas définie : simplexml_load_string()
:arrow: documentation de la fonction simplexml_load_string() : n'existe que dans la version (PHP 5)
:arrow: tu dois pas avoir installé (PHP 5)
:arrow: passe à (PHP 5) ou trouve/réalise une fonction de substitution pour faire la même chose