title: How to edit a php/html file using PHP
body: <p>I'm trying to design an interface to change <code>&lt;img&gt;</code> sources throughout my website, so that I don't need to change the sources by hand anytime we want to change what images my site displays.</p>
  
  <p>I looked at <a href="http://us.php.net/manual/en/class.domdocument.php" rel="nofollow noreferrer">DOMDocument</a> already, and while it's useful for accessing the different elements in a file, it wraps the files in it's own HTML tags, which messes up the files (I already tried looking <a href="https://stackoverflow.com/questions/4879946/domdocument-savehtml-without-html-wrapper">here</a> but those solutions didn't work for me)</p>
  
  <p>Is there a better way to take a file, retrieve element information and attributes (like src and id) from img tags, edit those elements, and save the file?</p>