I have an XML response that I'm trying to extract a single item from, here is the response:
<GetProductStockResponse>
<GetProductStockResult>
<ProductStock>
<Product>
<sku>AA-HF461</sku>
<stock>23</stock>
</Product>
</ProductStock>
</GetProductStockResult>
</GetProductStockResponse>
If I echo this to the screen is is displayed as:
AA-HF461 23
I tried using simplexml_load_string but it's not working, nothing comes out:
$res = $soapClient->GetProductStock($q_param);
$clfResponse = $res->GetProductStockResult;
echo $clfResponse; // This works - see above
$xml = simplexml_load_string($clfResponse);
echo $xml; // This is empty
echo $xml->stock; // This is empty
Am I making a schoolboy error?