Hey there,
I am trying to develop a php file to log certain data into an xml file. The coding seems to work however the second time around the data is not saved on the xml file.
Heres the code :
$xml_string =
"<errorlog>
<report>
<host>$host</host>
<ipaddress>$ip</ipaddress>
<errmsg>$subject</errmsg>
<date>$dt</date>
</report>
</errorlog>
";
and heres the error msg :
Only one top level element is allowed in an XML document. Error processing resource 'file://wwwroot/errorlog.xml'. Line 9, Position 2
<errorlog>
-^
The error i guess is because the second time around the script attempts to create the top level <errorlog> again. Is there a way to check for its presence or to avoid it from doing that ?!
Appreciate your help !
Hussam