lundi 3 août 2015

How to get array of key from amazon s3 object

I am using amazon s3 v3 php sdk and i am trying to get key of all object for that i am using

s3->listObjects([ 'Bucket' => $somebucketName]);

this function is working fine and i am getting all object under $somebucketName bucket and its in below form

Aws\Result Object
(
    [data:Aws\Result:private] => Array
        (
            [IsTruncated] => 
            [Marker] => 
            [Contents] => Array
                (
                    [0] => Array
                        (
                            [Key] => 1.PNG
                            [LastModified] => Aws\Api\DateTimeResult Object
                                (
                                    [date] => 2015-07-14 07:22:25.000000
                                    [timezone_type] => 2
                                    [timezone] => Z
                                )

                            [ETag] => "23f423234v23v42424d23"
                            [Size] => 19980
                            [StorageClass] => STANDARD
                            [Owner] => Array
                                (
                                    [DisplayName] => sfsfssfsdf
                                    [ID] => 242f2342242342252g42f42vt34
                                )

                        )

                    [1] => Array
                        (
                            [Key] => 58.jpg
                            [LastModified] => Aws\Api\DateTimeResult Object
                                (
                                    [date] => 2015-07-14 07:20:26.000000
                                    [timezone_type] => 2
                                    [timezone] => Z
                                )

                            [ETag] => "vrtet4v4t54tvt4gvtgv45"
                            [Size] => 1226694
                            [StorageClass] => STANDARD
                            [Owner] => Array
                                (
                                    [DisplayName] => sfsfssfsdf
                                    [ID] => 34t3t3t3y43y4yg5yy4vg6u676
                                )

                        )

                    [2] => Array
                        (
                            [Key] => HDFHDFHDFHDFHFHFH
                            [LastModified] => Aws\Api\DateTimeResult Object
                                (
                                    [date] => 2015-07-30 12:07:42.000000
                                    [timezone_type] => 2
                                    [timezone] => Z
                                )

                            [ETag] => "3453345343rcf3f3r3r3f"

                )

            [Name] => SFSSD
            [Prefix] => 
            [MaxKeys] => 1000
            [@metadata] => Array
                (
                    [statusCode] => 200
                    [effectiveUri] => http://ift.tt/1K0wYnH
                    [headers] => Array
                        (
                            [x-amz-id-2] =>  sdfsfs234sfs
                            [x-amz-request-id] => HSJFSD899
                            [date] => Mon, 03 Aug 2015 06:46:48 GMT
                            [x-amz-bucket-region] => us-west-2
                            [content-type] => application/xml
                            [transfer-encoding] => chunked
                            [server] => AmazonS3
                        )

                )

        )

)

now my question is that how to get array of key like below from above object

array("1.png","58.jpg","HDDHDFHDHDGH);




Aucun commentaire:

Enregistrer un commentaire