I am using PHP to parse an XML response,
After some debugging, I have found a strange occurrence with my application. This is what I've been doing, I make the request and then I echo the entire response. The response is as-expected XML. When I copy this entire document and paste it into a php script which then runs simplexml_load_string on it, it spits out a Simple XML object like you would expect.
When I run it from the actual request, I print the response, I can see it, looks like normal XML. But then when I load the xml string using simplexml_load_string, it prints nothing at all. I have tried a few variations but every object it returns is just empty. The script is running because I echo "Done" at the end of the script. I have tried each of these:
$xml = simplexml_load_string(htmlspecialchars_decode($response_body));
$xml = simplexml_load_string($response_body);
$xml = new SimpleXMLElement($response_body);
The first one I've tried (with htmlspecialchars_decode) is because, for some reason, the unedited response, prints with < signs instead of '<' signs. Any suggestions, or advice would be hugely helpful!
By the way, I am printing the object like this:
print_r($xml);