use xpath
to select namespaced elements with simplexml
:
$domeinnaamuitxml = (string)$xml->xpath("//domain:name"}[0];
Comment: The above code requires PHP >= 5.4 because of the [0]
(array dereferencing). In an older version of PHP, do:
$domeinnaamuitxml = $xml->xpath("//domain:name"};
$domeinnaamuitxml = (string)$domeinnaamuitxml[0];
see it working: https://eval.in/101915