yaniv81 Posted February 14, 2011 Report Share Posted February 14, 2011 Hi, I just started watching the videos about loading data from XML file, and I was wondering, how can I add data to the XML file with php? I googled it, and basically found nothing useful(does it so complicated???), I thought it's a common thing... Quote Link to comment Share on other sites More sharing options...
falkencreative Posted February 15, 2011 Report Share Posted February 15, 2011 I wouldn't think it should be all that complicated... As far as I understand it, an XML file is a basic text file with specific tags that indicate meaning/hierarchy. I would think you would be able to open up the .xml file like you would any text file and edit it with PHP's standard editing functions (fopen, fread, fwrite, file_get_contents, etc. Take a look at php.net for more.) Quote Link to comment Share on other sites More sharing options...
yaniv81 Posted February 15, 2011 Author Report Share Posted February 15, 2011 thanks Ben, I manage to do it with fopen and fwrite any way, I guess what I wanted to do is best done with mysql... Quote Link to comment Share on other sites More sharing options...
BeeDev Posted February 15, 2011 Report Share Posted February 15, 2011 You can create an XMLDom object with PHP, and load the XML document in that object. More info: http://www.w3schools.com/php/php_xml_dom.asp After that it's very easy to just add/delete/edit elements. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.