- simplexml_load_string: documentation ( source)
- print_r: documentation ( source)
<?php
$res = '
<rsp stat="fail" version="1.0">
<err code="1" msg="Invalid API key or user key"/>
</rsp>
';
$ret = simplexml_load_string($res);
print_r($ret->err[0]);