Forum Moderators: coopster
To clarify, when I echo $xml->asXML(); ,the node is updated, but when you save the file from the server, the original value remains. I thought it was permissions, so I set the file and folder to 777, but this has no effect? Is this supposed to save the value, or am I missing something?
Thanks in advance.
To clarify, when I echo $xml->asXML(); ,the node is updated, but when you save the file from the server, the original value remains.
You need to save the output from $xml->asXML() to your file (just as you are sending this output to the browser by echo'ing it). In order to do this you need to use PHP's file handling functions fopen(), fwrite() etc. The SimpleXML object itself does not do this for you, it just loads, it does not save. All manipulation of nodes/elements are done in memory.
The ouput from ->asXML() is just a plain old string. So there is no particular reason why this can't be written to a plain old text file.
You could try extending the SimpleXML object to add this functionality? Read way down the comments on the PHP: SimpleXML Functions - Manual [uk2.php.net] for some tips.