Note that there are some explanatory texts on larger screens.

plurals
  1. POIterating through amazon shopping API (big multi-dimensional array) through print_r
    primarykey
    data
    text
    <p>I've always had trouble with retrieving values in API-returned arrays, usually because they are so complex. Anyways, this one has me stumped.</p> <p>I'm not going to post the entire array here.. but below is the gist of it.</p> <p>Just to let you know, I have tried nesting several foreach loops, but I am getting several errors and I can't imagine there isn't an easier way to do it.</p> <p>Thanks for your help in advance.</p> <p>Sample of the output:</p> <pre><code>&lt;? Array ( [OperationRequest] =&gt; Array ( [HTTPHeaders] =&gt; Array ( [Header] =&gt; Array ( [Name] =&gt; UserAgent [Value] =&gt; PHP-SOAP/5.2.17 ) ) [RequestId] =&gt; a2d742d5-64b7-4de7-9c3d-a4c1cd525e7e [Arguments] =&gt; Array ( [Argument] =&gt; Array ( [Name] =&gt; Service [Value] =&gt; AWSECommerceService ) ) [RequestProcessingTime] =&gt; 0.382574 ) [Items] =&gt; Array ( [Request] =&gt; Array ( [IsValid] =&gt; True [ItemSearchRequest] =&gt; Array ( [Condition] =&gt; New [DeliveryMethod] =&gt; Ship [Keywords] =&gt; TV [MerchantId] =&gt; Amazon [ResponseGroup] =&gt; Small [ReviewSort] =&gt; -SubmissionDate [SearchIndex] =&gt; All ) ) [TotalResults] =&gt; 1664379 [TotalPages] =&gt; 166438 [Item] =&gt; Array ( [0] =&gt; Array ( [ASIN] =&gt; B0036WT3P2 [DetailPageURL] =&gt; http://www.amazon.com/Samsung-LN40C630-40-Inch-1080p-Black/dp/B0036WT3P2%3FSubscriptionId%3DAKIAJQJSA2B4JHSRNEXQ%26tag%3Dws%26linkCode%3Dsp1%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB0036WT3P2 [ItemLinks] =&gt; Array ( [ItemLink] =&gt; Array ( [0] =&gt; Array ( [Description] =&gt; Technical Details [URL] =&gt; http://www.amazon.com/Samsung-LN40C630-40-Inch-1080p-Black/dp/tech-data/B0036WT3P2%3FSubscriptionId%3DAKIAJQJSA2B4JHSRNEXQ%26tag%3Dws%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3DB0036WT3P2 ) [1] =&gt; Array ( [Description] =&gt; Add To Baby Registry [URL] =&gt; http://www.amazon.com/gp/registry/baby/add-item.html%3Fasin.0%3DB0036WT3P2%26SubscriptionId%3DAKIAJQJSA2B4JHSRNEXQ%26tag%3Dws%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3DB0036WT3P2 ) [2] =&gt; Array ( [Description] =&gt; Add To Wedding Registry [URL] =&gt; http://www.amazon.com/gp/registry/wedding/add-item.html%3Fasin.0%3DB0036WT3P2%26SubscriptionId%3DAKIAJQJSA2B4JHSRNEXQ%26tag%3Dws%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3DB0036WT3P2 ) [3] =&gt; Array ( [Description] =&gt; Add To Wishlist [URL] =&gt; http://www.amazon.com/gp/registry/wishlist/add-item.html%3Fasin.0%3DB0036WT3P2%26SubscriptionId%3DAKIAJQJSA2B4JHSRNEXQ%26tag%3Dws%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3DB0036WT3P2 ) [4] =&gt; Array ( [Description] =&gt; Tell A Friend [URL] =&gt; http://www.amazon.com/gp/pdp/taf/B0036WT3P2%3FSubscriptionId%3DAKIAJQJSA2B4JHSRNEXQ%26tag%3Dws%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3DB0036WT3P2 ) [5] =&gt; Array ( [Description] =&gt; All Customer Reviews [URL] =&gt; http://www.amazon.com/review/product/B0036WT3P2%3FSubscriptionId%3DAKIAJQJSA2B4JHSRNEXQ%26tag%3Dws%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3DB0036WT3P2 ) [6] =&gt; Array ( [Description] =&gt; All Offers [URL] =&gt; http://www.amazon.com/gp/offer-listing/B0036WT3P2%3FSubscriptionId%3DAKIAJQJSA2B4JHSRNEXQ%26tag%3Dws%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3DB0036WT3P2 ) ) ) [ItemAttributes] =&gt; Array ( [Manufacturer] =&gt; Samsung [ProductGroup] =&gt; CE [Title] =&gt; Samsung LN40C630 40-Inch 1080p 120 Hz LCD HDTV (Black) ) ?&gt; </code></pre> <p>I am trying to retrieve the ItemAttributes->Title part and the DetailPageURL. Looking forward to hearing suggestions.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload