SimpleXml generate XML document from PHP:
$oXml = new SimpleXMLElement('<itemlist></itemlist>');
foreach($aItems as $aItem)
{
$oXmlParameter = $oXml->addChild('item');
$oXmlParameter->addChild('title', htmlentities($aItem['title']));
$oXmlParameter->addChild('description', htmlentities($aItem['description']));
}
header('Content-type: text/xml');
echo $oXml->asXML();
exit;
$oXml = new SimpleXMLElement('<itemlist></itemlist>');
foreach($aItems as $aItem)
{
$oXmlParameter = $oXml->addChild('item');
$oXmlParameter->addChild('title', htmlentities($aItem['title']));
$oXmlParameter->addChild('description', htmlentities($aItem['description']));
}
header('Content-type: text/xml');
echo $oXml->asXML();
exit;
No comments:
Post a Comment