Re: logging data to xml

From: Date: Fri, 15 Aug 2003 15:20:49 +0000
Subject: Re: logging data to xml
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-159704@lists.php.net to get a copy of this message
* Thus wrote Jay Blanchard (jay.blanchard@niicommunications.com): > A couple of things occured to me, but I am not sure that they're > desirable... > > With </root> being the last tag (does it occupy its own line?) you could > (pseudo-code, not tested and certain to be incomplete)... > > while(!feof($theXMLLogFile)){ > $theXMLLine = fgets($theXMLLogFile, 255); > if($theXMLLine == "</root>"){ > $theNewLogLine = "stuff you need to write \n </root>"; > ereg_replace("</root>", "$theNewLogLine", > $theXMLLogFile); > } > } A little quicker: fseek($fh, -(strlen("</root>")), SEEK_END); fwrite($fh, $yourdata); fwrite($fh, "\n</root>"); Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#159704) next »