I have an xml file where am replacing the & with & then taking the & converting back to & to insert into the database. My script is not replacing the & with &.
function xml_entities($string) {
return strtr(
$string,
array(
"&" => "&",
)
);
}
$content=xml_entities(file_get_contents("http://www.site.com/feeds/xxxx/property.xml"));
file_put_contents("cleanme.xml",$content);
echo "File clean complete".'<br>';