- var_dump: documentation ( source)
- simplexml_load_string: documentation ( source)
<?php
$xmlresponse = '<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://www.cebroker.com/CEBrokerWebService/"><licensees><licensee
valid="true" State="FL" licensee_profession="RN"
licensee_number="2676612" state_license_format="" first_name="HENRY"
last_name="GEITER" ErrorCode="" Message="" TimeStamp="2/19/2022
4:53:35 AM" /></licensees></string>';
$xml_string = simplexml_load_string($xmlresponse);
echo 'First time, we only get it as a string, not as XML' . PHP_EOL;
echo '------------------------------------------'. PHP_EOL;
var_dump($xml_string); // We can see that it's just a stirng, not XML
echo PHP_EOL . PHP_EOL;
$licensees = simplexml_load_string($xml_string);
echo 'The second time, we do get it as XML' . PHP_EOL;
echo '------------------------------------------'. PHP_EOL;
var_dump($licensees); // Not it's actually read as XML