How to use PHP to load and update XML?

  • Thread starter Thread starter kennyfern
  • Start date Start date
K

kennyfern

Guest
I need help with a current project for a web class.

I need to use PHP to load in an XML file and add in a value and then write that changed information back out to the original XML file.

Currently I am using simpleXML_load_file() to load in the XML. I'm able to change the values that I want to and print that out to the screen. But I can't figure out how to do this to the original file.

Any ideas? If I write back out the current variable XML object will it have the exact same formatting as when it was first loaded in? Any help would be greatly appreciated.
 
Back
Top