In php I call a service that returns an XML to me. The problem I have is that within the XML there may be strange characters that break the XML when reading it. To read the XML I'm using the library SimpleXMLElement
and the line that breaks the XML is this:
RACIÓN Y SEGUIMIENTO DE ESTRATEGIAS ENFOCADAS A LA GENERACIÓN DEL NEGOCIO
How can I escape these characters?
Greetings.
This is how I get the XML:
$ctx = stream_context_create($opts);
syslog(LOG_INFO,'url_offers_cornerstone '.$url_offers_cornerstone.$filter);
$result = file_get_contents($url_offers_cornerstone.$filter, false, $ctx);
// Escapamos caracteres especiales en el XML
//$result = htmlspecialchars($result, ENT_XHTML,'UTF-8');
$resultt = remove_utf8_bom($result);
// Parseo y tratamiento del espacio de nombres
$sxe = new SimpleXMLElement($resultt);
// guardo en el bucket el fichero devuelto por CSOD
global $bucket;
$filename = $bucket . 'CSOD_offers_' . date('Y-m-d_H:i:s') . '.xml';
file_put_contents($filename, $result);
$sxe->registerXPathNamespace('a', 'www.CornerStoneOnDemand.com/Services/ATS');