$response = sendRequest($curl, doCreateDB($domainid, $dbname, $dbtype));
$responseXml = parseResponse($response);
function parseResponse($response_string)
{
$xml = new SimpleXMLElement($response_string);
if (!is_a($xml, 'SimpleXMLElement'))
throw new ApiRequestException("Cannot parse server response: {$response_string}");
return $xml;
}
full output
SimpleXMLElement Object
(
[@attributes] => Array
(
[version] => 1.5.0.0
)
[database] => SimpleXMLElement Object
(
[add-db] => SimpleXMLElement Object
(
[result] => SimpleXMLElement Object
(
[status] => error
[errcode] => 1007
[errtext] => Database with requested name already exists
)
)
)
)
Final output at above. Then I want to get specific node's value. Eg: i want to get status node.
I tried a few ways, but can't seems to print out the specific data.
echo $responseXml->database->{add-db}->result->status; // (nothing come out)
etc...