Jun 30, 2006
Up until some time ago I mainly used shared databases and distributed backups for syndicating content like store items, ring-tones, WAP games etc.
I used to be quite reluctant on implementing XML to share data among applications residing on different servers. This was mainly for reasons of performance issues with real time transfer of data between the XML server and the client application (most of the times a website). But with the current bandwidth and speed of the internet, my worries seem practically redundant.
So on the new www.miranet-webdesign.eu site I decided to implement and test XML syndication using XML feeds from www.miranet.nl.
Just for the fun of trying out something "new" I decided to use the PEAR unserializer.
I did not use the ZEND framework, because it is only suited for PHP5.
And that would be a problem with syndicating content toward a lot of sites that are still hosted on PHP4 servers (and not likely to change).
So what is the benefit of going this way? Check the code:
$options = array(
'complexType' => 'array', //make sure the returns are an array
'returnResult' => true // makes XML_Unserializer::unserialize return the results when unserializing is successful
//create new serializer object
$us = new XML_Unserializer($options);
//return an array representing the XML data
$result = $us->unserialize("http://www.miranet.nl/index.php?output=xml&page=$page", true);
//now we can examine the results and generally do what we like with them
Simply put, we can create PHP data structures (like arrays, objects etc) from XML input.
We can feed XML strings to the XML_Unserializer object with the unserialize method, and will get an array, or a new object in return for further processing in PHP.
If you like to read more on the subjects of XML I can certainly recommend the following pages:
There are no comments on this blog entry yet!
Send your comments to or post them right here!