I'm having an issue where when I store $msgIn (string) and it contains smybols like ampersand or currency values it will not save and cuts off from just before the symbol, is there a way to tell it to wrapp the message in CDATA tags?
$xml = @simplexml_load_file($this->currentChatLogFile);
$message = $xml->messages->addChild("message", $msgIn);
$message->addAttribute("timestamp", date("U"));
$message->addAttribute("pid", $uidIn);
$message->addAttribute("poster", $uname);
$message->addAttribute("ip", $_SERVER['REMOTE_ADDR']);
$xml->saveXML($this->currentChatLogFile);
Currently getting this when i submit Test & test2
:
`<?xml version="1.0" encoding="UTF-8"?>
<chatlog created="1393450231">
<messages>
<message timestamp="1393453404" pid="16" poster="core" ip="127.0.0.1">Test </message>
</messages>
</chatlog>`
Any suggestions/help greatly appreciated.