I have this xml file:
<flats>
<flat>
<images1>http://www.example.com/image1.jpg</images1>
<images2>http://www.example.com/image1.jpg</images2>
</flat>
</flats>
Which I need to load using php and then replace some node names to get this (just change image1 and image2 to images:
<flats>
<flat>
<images>http://www.example.com/image1.jpg</images>
<images>http://www.example.com/image1.jpg</images>
</flat>
</flats>
I managed to load and save the file, but I don't know how to replace the node names.
$xml_external_path = 'http://external-site.com/original.xml';
$xml = simplexml_load_file($xml_external_path);
$xml->asXml('updated.xml');
UPDATE: PHP
$xml_external_path = 'http://external-site.com/original.xml';
$xml = simplexml_load_file($xml_external_path);
print_r($xml);
$newXml = str_replace( 'images1', 'image',$xml ) ;
print_r($newXml);