I have a remote xml file: http://my-site/my-file.xml This file has this values:
<files>
  <file>
     <unique>444444</unique>
  </file>
  <file>
     <unique>666666</unique>
  </file>
  <file>
     <unique>888888</unique>
  </file>
</files>
I need to use php to replace the value of <unique>xxxxxx</unique> to be half its value, so that the file should be change to 
<files>
  <file>
     <unique>222222</unique>
  </file>
  <file>
     <unique>333333</unique>
  </file>
  <file>
     <unique>444444</unique>
  </file>
</files>
I got part of the function to open and save the file but not the find&replace code:
$xml_external_path = 'http://my-site/my-file.xml'; // THIS LINE MUST EXIST
$xml = simplexml_load_file($xml_external_path);// THIS LINE MUST EXIST
$searches = array();
$replacements = array();
foreach (....) {
    $searches[] = ....
    $replacements[] = ....
}
$newXml = simplexml_load_string( str_replace( $searches, $replacements, $xml->asXml() ) );
$newXml->asXml('new-xml.xml');// THIS LINE MUST EXIST
 
     
     
    