So I have this XML :-
<ApiResponse Status="OK">
<Errors/>
<Warnings/>
<RequestedCommand>namecheap.domains.getlist</RequestedCommand>
<CommandResponse Type="namecheap.domains.getList"></CommandResponse>
<Server>PHX01SBAPI02</Server>
<GMTTimeDifference>--7:00</GMTTimeDifference>
<ExecutionTime>0.07</ExecutionTime>
</ApiResponse>
How can I access the value of " Status " in ApiResponse ?
I tried :-
foreach($xml->ApiResponse->attributes() as $a => $b) {
echo $a,'="',$b,"\"\n";
}
But it throws this error :-
main(): Node no longer exists
Try simplexml_load_string..
$xmlArray = simplexml_load_string($xml);
$json = json_encode($xmlArray);
$xmlFormated = json_decode($json,TRUE);
print_r($xmlFormated);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.