If your PHP doesn't have wddx support installed, and you need it, and you don't want to install PEAR just for wddx, try this short piece of code, based on SimpleXML:
//can read any wddx file generated from php arrays. assumes var elements are only inside struct elements and that only one packet exists.
function wddx_read_node($node, $type)
{
switch($type)
{
case "boolean":
return (string)$node;
case "number":
case "binary":
case "string":
return (string)$node;
case "null":
return null;
case "array":
$a = array();
foreach($node as $subtype => $subnode)
{
$a[] = wddx_read_node($subnode, $subtype);
}
return $a;
case "struct":
$a = array();
foreach($node as $subtype => $subnode)
{
list($key, $value) = wddx_read_node($subnode, $subtype); //must be a var element
$a[$key] = $value;
}
return $a;
case "var":
list($subnode, $subtype) = getchild($node);
return array((string)$node["name"], wddx_read_node($subnode, $subtype));
case "data":
list($subnode, $subtype) = getchild($node);
return wddx_read_node($subnode, $subtype);
}
}
function wddx_read($string)
{
$xml = simplexml_load_string($string);
$d = wddx_read_node($xml->data, "data");
return $d;
}
important notice: this one may not work with all wddx input. multiple packets or variables outside a "struct" are not supported. basically, you always get a PHP (associative) array, never something else. feel free to make additions.