I would like to get specific value from XML data in Cake Php. This is what I've got so far:
after doing print_r($output) in controller this is what I've got;
<?xml version="1.0" encoding="UTF-8"?>
<response>
<xmlArray>
<numbers>52619657</numbers>
</xmlArray>
</response>
Because I don't know how to get it directly from xml, so I convert it to array in controller as cakePHP doc mention.
$xmlArray = Xml::toArray(Xml::build($out));
The result from print_r($xmlArray); is
Array
(
[response] => Array
(
[xmlArray] => Array
(
[numbers] => 52619657
)
)
)
I tried to get the numbers '52619657'. So my attempt is
print_r ($xmlArray['numbers']);
But it doesn't work (error is Undefined index:). So I try to use IN method like here, but actually I don't know how to do it. How do I get the number '52619657'? in cake PHP.
Thank you so much