Using the AWS PHP SDK to play around with S3 for the first time
$res = $s3->list_objects($bucket);
var_dump($res);
Shows me that I have a Contents
array with 4 elements in it
However var_dump($res->body->Contents)
yields only one XMLObject instead of a php array with for elements like it should.
What's going on?
The S3 library read the XML response and returns an XML/DOM object. It cannot be printed like a normal array. You are advised to iterate over it like it says in the PHP manual.
However, for quick tests you can cheat.
var_dump(json_decode(json_encode($xml)));
Personally, I would see if a JSON response can be returned - they are generally smaller, faster to parse, and easier to browse than DOMNode's or DOMLists.