문제

I can return nothing by trying to access the array like this:

$title = $response->Items->Item->ItemAttributes->Title;

$ISBN = $response->Items->Item->ItemAttributes->ISBN;

Any Help?

print_r($response) returns:

Array

( [OperationRequest] => stdClass Object ( [HTTPHeaders] => stdClass Object ( [Header] => stdClass Object ( [Name] => UserAgent [Value] => PHP-SOAP/5.3.24 )

            )

        [RequestId] => 827356ca-4459-45b3-abed-f4abf17e50ee
        [Arguments] => stdClass Object
            (
                [Argument] => stdClass Object
                    (
                        [Name] => Service
                        [Value] => AWSECommerceService
                    )

            )

        [RequestProcessingTime] => 0.186987
    )

[Items] => stdClass Object
    (
        [Request] => stdClass Object
            (
                [IsValid] => True
                [ItemSearchRequest] => stdClass Object
                    (
                        [Keywords] => 1933916958
                        [ResponseGroup] => Large
                        [SearchIndex] => Books
                    )

            )

        [TotalResults] => 1
        [TotalPages] => 1
        [MoreSearchResultsUrl] => http://www.amazon.com/gp/redirect.html?camp=2025&creative=386001&location=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fsearch%3Fkeywords%3D1933916958%26url%3Dsearch-alias%253Dstripbooks&linkCode=sp1&tag=&SubscriptionId=
        [Item] => stdClass Object
            (
                [ASIN] => 1933916958
                [DetailPageURL] => http://www.amazon.com/I-Am-Stumped-Lisa-Rivard/dp/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1933916958
                [ItemLinks] => stdClass Object
                    (
                        [ItemLink] => Array
                            (
                                [0] => stdClass Object
                                    (
                                        [Description] => Technical Details
                                        [URL] => http://www.amazon.com/I-Am-Stumped-Lisa-Rivard/dp/tech-data/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
                                    )

                                [1] => stdClass Object
                                    (
                                        [Description] => Add To Baby Registry
                                        [URL] => http://www.amazon.com/gp/registry/baby/add-item.html%3Fasin.0%3D1933916958%26SubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
                                    )

                                [2] => stdClass Object
                                    (
                                        [Description] => Add To Wedding Registry
                                        [URL] => http://www.amazon.com/gp/registry/wedding/add-item.html%3Fasin.0%3D1933916958%26SubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
                                    )

                                [3] => stdClass Object
                                    (
                                        [Description] => Add To Wishlist
                                        [URL] => http://www.amazon.com/gp/registry/wishlist/add-item.html%3Fasin.0%3D1933916958%26SubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
                                    )

                                [4] => stdClass Object
                                    (
                                        [Description] => Tell A Friend
                                        [URL] => http://www.amazon.com/gp/pdp/taf/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
                                    )

                                [5] => stdClass Object
                                    (
                                        [Description] => All Customer Reviews
                                        [URL] => http://www.amazon.com/review/product/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
                                    )

                                [6] => stdClass Object
                                    (
                                        [Description] => All Offers
                                        [URL] => http://www.amazon.com/gp/offer-listing/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
                                    )

                            )

                    )

                [SalesRank] => 2163913
                [SmallImage] => stdClass Object
                    (
                        [URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL75_.jpg
                        [Height] => stdClass Object
                            (
                                [_] => 75
                                [Units] => pixels
                            )

                        [Width] => stdClass Object
                            (
                                [_] => 75
                                [Units] => pixels
                            )

                    )

                [MediumImage] => stdClass Object
                    (
                        [URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL160_.jpg
                        [Height] => stdClass Object
                            (
                                [_] => 160
                                [Units] => pixels
                            )

                        [Width] => stdClass Object
                            (
                                [_] => 160
                                [Units] => pixels
                            )

                    )

                [LargeImage] => stdClass Object
                    (
                        [URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L.jpg
                        [Height] => stdClass Object
                            (
                                [_] => 500
                                [Units] => pixels
                            )

                        [Width] => stdClass Object
                            (
                                [_] => 500
                                [Units] => pixels
                            )

                    )

                [ImageSets] => stdClass Object
                    (
                        [ImageSet] => stdClass Object
                            (
                                [SwatchImage] => stdClass Object
                                    (
                                        [URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL30_.jpg
                                        [Height] => stdClass Object
                                            (
                                                [_] => 30
                                                [Units] => pixels
                                            )

                                        [Width] => stdClass Object
                                            (
                                                [_] => 30
                                                [Units] => pixels
                                            )

                                    )

                                [SmallImage] => stdClass Object
                                    (
                                        [URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL75_.jpg
                                        [Height] => stdClass Object
                                            (
                                                [_] => 75
                                                [Units] => pixels
                                            )

                                        [Width] => stdClass Object
                                            (
                                                [_] => 75
                                                [Units] => pixels
                                            )

                                    )

                                [ThumbnailImage] => stdClass Object
                                    (
                                        [URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL75_.jpg
                                        [Height] => stdClass Object
                                            (
                                                [_] => 75
                                                [Units] => pixels
                                            )

                                        [Width] => stdClass Object
                                            (
                                                [_] => 75
                                                [Units] => pixels
                                            )

                                    )

                                [TinyImage] => stdClass Object
                                    (
                                        [URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL110_.jpg
                                        [Height] => stdClass Object
                                            (
                                                [_] => 110
                                                [Units] => pixels
                                            )

                                        [Width] => stdClass Object
                                            (
                                                [_] => 110
                                                [Units] => pixels
                                            )

                                    )

                                [MediumImage] => stdClass Object
                                    (
                                        [URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L._SL160_.jpg
                                        [Height] => stdClass Object
                                            (
                                                [_] => 160
                                                [Units] => pixels
                                            )

                                        [Width] => stdClass Object
                                            (
                                                [_] => 160
                                                [Units] => pixels
                                            )

                                    )

                                [LargeImage] => stdClass Object
                                    (
                                        [URL] => http://ecx.images-amazon.com/images/I/51vOOdcil6L.jpg
                                        [Height] => stdClass Object
                                            (
                                                [_] => 500
                                                [Units] => pixels
                                            )

                                        [Width] => stdClass Object
                                            (
                                                [_] => 500
                                                [Units] => pixels
                                            )

                                    )

                                [Category] => primary
                            )

                    )

                [ItemAttributes] => stdClass Object
                    (
                        [Author] => Lisa Rivard
                        [Binding] => Paperback
                        [Creator] => stdClass Object
                            (
                                [_] => Colleen Murray Fisher
                                [Role] => Illustrator
                            )

                        [EAN] => 9781933916958
                        [EANList] => stdClass Object
                            (
                                [EANListElement] => 9781933916958
                            )

                        [ISBN] => 1933916958
                        [ItemDimensions] => stdClass Object
                            (
                                [Height] => stdClass Object
                                    (
                                        [_] => 878
                                        [Units] => hundredths-inches
                                    )

                                [Length] => stdClass Object
                                    (
                                        [_] => 31
                                        [Units] => hundredths-inches
                                    )

                                [Weight] => stdClass Object
                                    (
                                        [_] => 30
                                        [Units] => hundredths-pounds
                                    )

                                [Width] => stdClass Object
                                    (
                                        [_] => 866
                                        [Units] => hundredths-inches
                                    )

                            )

                        [Label] => Ferne Press
                        [Languages] => stdClass Object
                            (
                                [Language] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [Name] => English
                                                [Type] => Unknown
                                            )

                                        [1] => stdClass Object
                                            (
                                                [Name] => English
                                                [Type] => Original Language
                                            )

                                        [2] => stdClass Object
                                            (
                                                [Name] => English
                                                [Type] => Published
                                            )

                                    )

                            )

                        [ListPrice] => stdClass Object
                            (
                                [Amount] => 1095
                                [CurrencyCode] => USD
                                [FormattedPrice] => $10.95
                            )

                        [Manufacturer] => Ferne Press
                        [NumberOfItems] => 1
                        [NumberOfPages] => 32
                        [PackageDimensions] => stdClass Object
                            (
                                [Height] => stdClass Object
                                    (
                                        [_] => 30
                                        [Units] => hundredths-inches
                                    )

                                [Length] => stdClass Object
                                    (
                                        [_] => 890
                                        [Units] => hundredths-inches
                                    )

                                [Weight] => stdClass Object
                                    (
                                        [_] => 35
                                        [Units] => hundredths-pounds
                                    )

                                [Width] => stdClass Object
                                    (
                                        [_] => 880
                                        [Units] => hundredths-inches
                                    )

                            )

                        [ProductGroup] => Book
                        [ProductTypeName] => ABIS_BOOK
                        [PublicationDate] => 2012-02-15
                        [Publisher] => Ferne Press
                        [SKU] => 38594
                        [Studio] => Ferne Press
                        [Title] => I Am Stumped!
                    )

                [OfferSummary] => stdClass Object
                    (
                        [LowestNewPrice] => stdClass Object
                            (
                                [Amount] => 652
                                [CurrencyCode] => USD
                                [FormattedPrice] => $6.52
                            )

                        [LowestUsedPrice] => stdClass Object
                            (
                                [Amount] => 1
                                [CurrencyCode] => USD
                                [FormattedPrice] => $0.01
                            )

                        [TotalNew] => 9
                        [TotalUsed] => 6
                        [TotalCollectible] => 0
                        [TotalRefurbished] => 0
                    )

                [Offers] => stdClass Object
                    (
                        [TotalOffers] => 1
                        [TotalOfferPages] => 1
                        [MoreOffersUrl] => http://www.amazon.com/gp/offer-listing/1933916958%3FSubscriptionId%3D%26tag%3D%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D1933916958
                        [Offer] => stdClass Object
                            (
                                [OfferAttributes] => stdClass Object
                                    (
                                        [Condition] => New
                                    )

                                [OfferListing] => stdClass Object
                                    (
                                        [OfferListingId] => aHNL56yCKgoOwR9cqtskiy8iY%2B6ft1PDE%2FNUX7mlIfBkGcVKgCxSkvahafNTpHaN2YmBHIHfE2h4hONpYIwIED02MwIG2u4dSC4t%2BSaYVh8cRJvanet8VA%3D%3D
                                        [Price] => stdClass Object
                                            (
                                                [Amount] => 986
                                                [CurrencyCode] => USD
                                                [FormattedPrice] => $9.86
                                            )

                                        [AmountSaved] => stdClass Object
                                            (
                                                [Amount] => 109
                                                [CurrencyCode] => USD
                                                [FormattedPrice] => $1.09
                                            )

                                        [PercentageSaved] => 10
                                        [Availability] => Usually ships in 24 hours
                                        [AvailabilityAttributes] => stdClass Object
                                            (
                                                [AvailabilityType] => now
                                                [MinimumHours] => 0
                                                [MaximumHours] => 0
                                            )

                                        [IsEligibleForSuperSaverShipping] => 1
                                    )

                            )

                    )

                [CustomerReviews] => stdClass Object
                    (
                        [IFrameURL] => http://www.amazon.com/reviews/iframe?akid=&alinkCode=sp1&asin=1933916958&atag=&exp=2013-08-08T23%3A01%3A28Z&v=2&sig=ooHZSabKAym%2BTAQVErbn36Ng95H65hAhTUgn9REzmE8%3D
                        [HasReviews] => 1
                    )

                [EditorialReviews] => stdClass Object
                    (
                        [EditorialReview] => stdClass Object
                            (
                                [Source] => Product Description
                                [Content] => All Aiden wants to do is play with his friends, but his name starts with the wrong letter, he's wearing the wrong color, and is eating the wrong food. He's so confused that he's stumped! Lisa Rivard's I Am Stumped! teaches kids how to get along and that three is not a crowd.
                                [IsLinkSuppressed] => 
                            )

                    )

                [BrowseNodes] => stdClass Object
                    (
                        [BrowseNode] => stdClass Object
                            (
                                [BrowseNodeId] => 3153
                                [Name] => Friendship
                                [Ancestors] => stdClass Object
                                    (
                                        [BrowseNode] => stdClass Object
                                            (
                                                [BrowseNodeId] => 7009087011
                                                [Name] => Friendship, Social Skills & School Life
                                                [Ancestors] => stdClass Object
                                                    (
                                                        [BrowseNode] => stdClass Object
                                                            (
                                                                [BrowseNodeId] => 1084192
                                                                [Name] => Growing Up & Facts of Life
                                                                [Ancestors] => stdClass Object
                                                                    (
                                                                        [BrowseNode] => stdClass Object
                                                                            (
                                                                                [BrowseNodeId] => 4
                                                                                [Name] => Children's Books
                                                                                [Ancestors] => stdClass Object
                                                                                    (
                                                                                        [BrowseNode] => stdClass Object
                                                                                            (
                                                                                                [BrowseNodeId] => 1000
                                                                                                [Name] => Subjects
                                                                                                [IsCategoryRoot] => 1
                                                                                                [Ancestors] => stdClass Object
                                                                                                    (
                                                                                                        [BrowseNode] => stdClass Object
                                                                                                            (
                                                                                                                [BrowseNodeId] => 283155
                                                                                                                [Name] => Books
                                                                                                            )

                                                                                                    )

                                                                                            )

                                                                                    )

                                                                            )

                                                                    )

                                                            )

                                                    )

                                            )

                                    )

                            )

                    )

            )

    )

)

도움이 되었습니까?

해결책

$title = $response['Items']->Item->ItemAttributes->Title;
$ISBN = $response['Items']->Item->ItemAttributes->ISBN;

Response is an Array not an object in the case above.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top