title: PHP open file and replace content
body: <pre><code>&lt;?php
  $modcontent = file_get_contents('hello.xml');
  preg_match("/&lt;Content(.*?)&gt;(.+?)&lt;\/Content/s", $modcontent, $xmlmatches);
  $search  = array('&lt;![CDATA[',']]&gt;');
  $replace = array('','');
  $thenewone = str_replace($search, $replace, $xmlmatches[2]);
  fopen('hello.xml');
  fwrite($thenewone);
  fclose('hello.xml');
  ?&gt;
  </code></pre>
  
  <p>Hi, starting from the code above (which doesn't work), can you make it so it will modify that hello.xml file to keep only the content between , like in the preg_match? The hello.xml is here <a href="http://www.google.com/ig/modules/hello.xml" rel="nofollow">http://www.google.com/ig/modules/hello.xml</a>.
    Since my PHP and my English knowledge is quite low, I'll explain again in different words, hopefully you'll understand what I mean. I want a PHP script that can open the hello.xml file, read the content between the Content tags, write that content and replace everything else in the file and save the hello.xml file. Therefore, after all this operation, .xml should contain only <em>Hello, world!</em>.
  Thanks a lot!</p>