I have this code:
function parse_aggregators_xml($aggregators_xml) {
$simple_xml = new MySimpleXML();
return $simple_xml->xml_load_string($aggregators_xml, 'array');
}
$xml = file_get_contents(XML_TEMPLATE);
if (empty($xml)) return false;
$data = parse_aggregators_xml($aggregators_xml);
$data = json_decode(json_encode($data));
echo "<pre>";print_r($data );echo "</pre>";
the output of the xml is like this:
stdClass Object
(
[aggregator] => Array
(
[0] => stdClass Object
(
[@attributes] => stdClass Object
(
[enabled] => true
)
[id] => 2
[name] => feedagg.com *
[step] => Array
(
[0] => stdClass Object
(
[order] => 2
[params] => stdClass Object
.............................................
I am able to serialize the data, but unserializing it cause some errors:
Catchable fatal error: Object of class stdClass could not be converted to string in <file>.php on line 83
Is there some other way to serialize the data properly and also unserialize successfully?
Thanks!
~kazuo