我将如何解析以下内容以获取从亚马逊产品广告 APIdescription
检索到的产品的、title
、 商品编号等?
我使用了以下内容,但不一致。
$response = $client->responseGroup('Small,Images')->category('Books')->search($search);
foreach ($response->Items->Request->Item as $message) {
echo $message->Description;
}
下面的输出:也可以在pastebin上找到。下面的代码是输出。我想从对象中选择标题、描述和 url 数据,最好是数组格式。
有任何想法吗?
object(stdClass)#6 (2) {
["OperationRequest"]=>
object(stdClass)#7 (4) {
["HTTPHeaders"]=>
object(stdClass)#8 (1) {
["Header"]=>
object(stdClass)#9 (2) {
["Name"]=>
string(9) "UserAgent"
["Value"]=>
string(26) "PHP-SOAP/5.3.2-1ubuntu4.18"
}
}
["RequestId"]=>
string(36) "cbcaa978-487c-4d83-8986-6a641b7d9c00"
["Arguments"]=>
object(stdClass)#10 (1) {
["Argument"]=>
object(stdClass)#11 (2) {
["Name"]=>
string(7) "Service"
["Value"]=>
string(19) "AWSECommerceService"
}
}
["RequestProcessingTime"]=>
float(0.081366)
}
["Items"]=>
object(stdClass)#12 (5) {
["Request"]=>
object(stdClass)#13 (2) {
["IsValid"]=>
string(4) "True"
["ItemSearchRequest"]=>
object(stdClass)#14 (3) {
["Keywords"]=>
string(9) "airplanes"
["ResponseGroup"]=>
array(2) {
[0]=>
string(5) "Small"
[1]=>
string(6) "Images"
}
["SearchIndex"]=>
string(5) "Books"
}
}
["TotalResults"]=>
int(21343)
["TotalPages"]=>
int(2135)
["MoreSearchResultsUrl"]=>
string(237) "http://www.amazon.com/gp/redirect.html?camp=2025&creative=386001&location=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fsearch%3Fkeywords%3Dairplanes%26url%3Dsearch-alias%253Dstripbooks&linkCode=sp1&tag=xxxxxxxxxxxxxxbet-20&SubscriptionId=AKIAII3UF3HPAPY3SMDQ"
["Item"]=>
array(10) {
[0]=>
object(stdClass)#15 (8) {
["ASIN"]=>
string(10) "0789465213"
["DetailPageURL"]=>
string(205) "http://www.amazon.com/Big-Book-Airplanes-DK-Publishing/dp/0789465213%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0789465213"
["ItemLinks"]=>
object(stdClass)#16 (1) {
["ItemLink"]=>
array(7) {
[0]=>
object(stdClass)#17 (2) {
["Description"]=>
string(17) "Technical Details"
["URL"]=>
string(215) "http://www.amazon.com/Big-Book-Airplanes-DK-Publishing/dp/tech-data/0789465213%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0789465213"
}
[1]=>
object(stdClass)#18 (2) {
["Description"]=>
string(20) "Add To Baby Registry"
["URL"]=>
string(211) "http://www.amazon.com/gp/registry/baby/add-item.html%3Fasin.0%3D0789465213%26SubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0789465213"
}
[2]=>
object(stdClass)#19 (2) {
["Description"]=>
string(23) "Add To Wedding Registry"
["URL"]=>
string(214) "http://www.amazon.com/gp/registry/wedding/add-item.html%3Fasin.0%3D0789465213%26SubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0789465213"
}
[3]=>
object(stdClass)#20 (2) {
["Description"]=>
string(15) "Add To Wishlist"
["URL"]=>
string(215) "http://www.amazon.com/gp/registry/wishlist/add-item.html%3Fasin.0%3D0789465213%26SubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0789465213"
}
[4]=>
object(stdClass)#21 (2) {
["Description"]=>
string(13) "Tell A Friend"
["URL"]=>
string(180) "http://www.amazon.com/gp/pdp/taf/0789465213%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0789465213"
}
[5]=>
object(stdClass)#22 (2) {
["Description"]=>
string(20) "All Customer Reviews"
["URL"]=>
string(184) "http://www.amazon.com/review/product/0789465213%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0789465213"
}
[6]=>
object(stdClass)#23 (2) {
["Description"]=>
string(10) "All Offers"
["URL"]=>
string(186) "http://www.amazon.com/gp/offer-listing/0789465213%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0789465213"
}
}
}
["SmallImage"]=>
object(stdClass)#24 (3) {
["URL"]=>
string(60) "http://ecx.images-amazon.com/images/I/51G392LNnWL._SL75_.jpg"
["Height"]=>
object(stdClass)#25 (2) {
["_"]=>
string(2) "75"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#26 (2) {
["_"]=>
string(2) "56"
["Units"]=>
string(6) "pixels"
}
}
["MediumImage"]=>
object(stdClass)#27 (3) {
["URL"]=>
string(61) "http://ecx.images-amazon.com/images/I/51G392LNnWL._SL160_.jpg"
["Height"]=>
object(stdClass)#28 (2) {
["_"]=>
string(3) "160"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#29 (2) {
["_"]=>
string(3) "120"
["Units"]=>
string(6) "pixels"
}
}
["LargeImage"]=>
object(stdClass)#30 (3) {
["URL"]=>
string(53) "http://ecx.images-amazon.com/images/I/51G392LNnWL.jpg"
["Height"]=>
object(stdClass)#31 (2) {
["_"]=>
string(3) "500"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#32 (2) {
["_"]=>
string(3) "376"
["Units"]=>
string(6) "pixels"
}
}
["ImageSets"]=>
object(stdClass)#33 (1) {
["ImageSet"]=>
object(stdClass)#34 (7) {
["SwatchImage"]=>
object(stdClass)#35 (3) {
["URL"]=>
string(60) "http://ecx.images-amazon.com/images/I/51G392LNnWL._SL30_.jpg"
["Height"]=>
object(stdClass)#36 (2) {
["_"]=>
string(2) "30"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#37 (2) {
["_"]=>
string(2) "23"
["Units"]=>
string(6) "pixels"
}
}
["SmallImage"]=>
object(stdClass)#38 (3) {
["URL"]=>
string(60) "http://ecx.images-amazon.com/images/I/51G392LNnWL._SL75_.jpg"
["Height"]=>
object(stdClass)#39 (2) {
["_"]=>
string(2) "75"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#40 (2) {
["_"]=>
string(2) "56"
["Units"]=>
string(6) "pixels"
}
}
["ThumbnailImage"]=>
object(stdClass)#41 (3) {
["URL"]=>
string(60) "http://ecx.images-amazon.com/images/I/51G392LNnWL._SL75_.jpg"
["Height"]=>
object(stdClass)#42 (2) {
["_"]=>
string(2) "75"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#43 (2) {
["_"]=>
string(2) "56"
["Units"]=>
string(6) "pixels"
}
}
["TinyImage"]=>
object(stdClass)#44 (3) {
["URL"]=>
string(61) "http://ecx.images-amazon.com/images/I/51G392LNnWL._SL110_.jpg"
["Height"]=>
object(stdClass)#45 (2) {
["_"]=>
string(3) "110"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#46 (2) {
["_"]=>
string(2) "83"
["Units"]=>
string(6) "pixels"
}
}
["MediumImage"]=>
object(stdClass)#47 (3) {
["URL"]=>
string(61) "http://ecx.images-amazon.com/images/I/51G392LNnWL._SL160_.jpg"
["Height"]=>
object(stdClass)#48 (2) {
["_"]=>
string(3) "160"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#49 (2) {
["_"]=>
string(3) "120"
["Units"]=>
string(6) "pixels"
}
}
["LargeImage"]=>
object(stdClass)#50 (3) {
["URL"]=>
string(53) "http://ecx.images-amazon.com/images/I/51G392LNnWL.jpg"
["Height"]=>
object(stdClass)#51 (2) {
["_"]=>
string(3) "500"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#52 (2) {
["_"]=>
string(3) "376"
["Units"]=>
string(6) "pixels"
}
}
["Category"]=>
string(7) "primary"
}
}
["ItemAttributes"]=>
object(stdClass)#53 (4) {
["Author"]=>
string(13) "DK Publishing"
["Manufacturer"]=>
string(11) "DK CHILDREN"
["ProductGroup"]=>
string(4) "Book"
["Title"]=>
string(21) "Big Book of Airplanes"
}
}
[1]=>
object(stdClass)#54 (8) {
["ASIN"]=>
string(10) "0753459159"
["DetailPageURL"]=>
string(211) "http://www.amazon.com/Amazing-Airplanes-Machines-Tony-Mitton/dp/0753459159%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0753459159"
["ItemLinks"]=>
object(stdClass)#55 (1) {
["ItemLink"]=>
array(7) {
[0]=>
object(stdClass)#56 (2) {
["Description"]=>
string(17) "Technical Details"
["URL"]=>
string(221) "http://www.amazon.com/Amazing-Airplanes-Machines-Tony-Mitton/dp/tech-data/0753459159%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0753459159"
}
[1]=>
object(stdClass)#57 (2) {
["Description"]=>
string(20) "Add To Baby Registry"
["URL"]=>
string(211) "http://www.amazon.com/gp/registry/baby/add-item.html%3Fasin.0%3D0753459159%26SubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0753459159"
}
[2]=>
object(stdClass)#58 (2) {
["Description"]=>
string(23) "Add To Wedding Registry"
["URL"]=>
string(214) "http://www.amazon.com/gp/registry/wedding/add-item.html%3Fasin.0%3D0753459159%26SubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0753459159"
}
[3]=>
object(stdClass)#59 (2) {
["Description"]=>
string(15) "Add To Wishlist"
["URL"]=>
string(215) "http://www.amazon.com/gp/registry/wishlist/add-item.html%3Fasin.0%3D0753459159%26SubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0753459159"
}
[4]=>
object(stdClass)#60 (2) {
["Description"]=>
string(13) "Tell A Friend"
["URL"]=>
string(180) "http://www.amazon.com/gp/pdp/taf/0753459159%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0753459159"
}
[5]=>
object(stdClass)#61 (2) {
["Description"]=>
string(20) "All Customer Reviews"
["URL"]=>
string(184) "http://www.amazon.com/review/product/0753459159%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0753459159"
}
[6]=>
object(stdClass)#62 (2) {
["Description"]=>
string(10) "All Offers"
["URL"]=>
string(186) "http://www.amazon.com/gp/offer-listing/0753459159%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0753459159"
}
}
}
["SmallImage"]=>
object(stdClass)#63 (3) {
["URL"]=>
string(60) "http://ecx.images-amazon.com/images/I/51VcEPd9jqL._SL75_.jpg"
["Height"]=>
object(stdClass)#64 (2) {
["_"]=>
string(2) "75"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#65 (2) {
["_"]=>
string(2) "74"
["Units"]=>
string(6) "pixels"
}
}
["MediumImage"]=>
object(stdClass)#66 (3) {
["URL"]=>
string(61) "http://ecx.images-amazon.com/images/I/51VcEPd9jqL._SL160_.jpg"
["Height"]=>
object(stdClass)#67 (2) {
["_"]=>
string(3) "160"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#68 (2) {
["_"]=>
string(3) "157"
["Units"]=>
string(6) "pixels"
}
}
["LargeImage"]=>
object(stdClass)#69 (3) {
["URL"]=>
string(53) "http://ecx.images-amazon.com/images/I/51VcEPd9jqL.jpg"
["Height"]=>
object(stdClass)#70 (2) {
["_"]=>
string(3) "500"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#71 (2) {
["_"]=>
string(3) "491"
["Units"]=>
string(6) "pixels"
}
}
["ImageSets"]=>
object(stdClass)#72 (1) {
["ImageSet"]=>
object(stdClass)#73 (7) {
["SwatchImage"]=>
object(stdClass)#74 (3) {
["URL"]=>
string(60) "http://ecx.images-amazon.com/images/I/51VcEPd9jqL._SL30_.jpg"
["Height"]=>
object(stdClass)#75 (2) {
["_"]=>
string(2) "30"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#76 (2) {
["_"]=>
string(2) "29"
["Units"]=>
string(6) "pixels"
}
}
["SmallImage"]=>
object(stdClass)#77 (3) {
["URL"]=>
string(60) "http://ecx.images-amazon.com/images/I/51VcEPd9jqL._SL75_.jpg"
["Height"]=>
object(stdClass)#78 (2) {
["_"]=>
string(2) "75"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#79 (2) {
["_"]=>
string(2) "74"
["Units"]=>
string(6) "pixels"
}
}
["ThumbnailImage"]=>
object(stdClass)#80 (3) {
["URL"]=>
string(60) "http://ecx.images-amazon.com/images/I/51VcEPd9jqL._SL75_.jpg"
["Height"]=>
object(stdClass)#81 (2) {
["_"]=>
string(2) "75"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#82 (2) {
["_"]=>
string(2) "74"
["Units"]=>
string(6) "pixels"
}
}
["TinyImage"]=>
object(stdClass)#83 (3) {
["URL"]=>
string(61) "http://ecx.images-amazon.com/images/I/51VcEPd9jqL._SL110_.jpg"
["Height"]=>
object(stdClass)#84 (2) {
["_"]=>
string(3) "110"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#85 (2) {
["_"]=>
string(3) "108"
["Units"]=>
string(6) "pixels"
}
}
["MediumImage"]=>
object(stdClass)#86 (3) {
["URL"]=>
string(61) "http://ecx.images-amazon.com/images/I/51VcEPd9jqL._SL160_.jpg"
["Height"]=>
object(stdClass)#87 (2) {
["_"]=>
string(3) "160"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#88 (2) {
["_"]=>
string(3) "157"
["Units"]=>
string(6) "pixels"
}
}
["LargeImage"]=>
object(stdClass)#89 (3) {
["URL"]=>
string(53) "http://ecx.images-amazon.com/images/I/51VcEPd9jqL.jpg"
["Height"]=>
object(stdClass)#90 (2) {
["_"]=>
string(3) "500"
["Units"]=>
string(6) "pixels"
}
["Width"]=>
object(stdClass)#91 (2) {
["_"]=>
string(3) "491"
["Units"]=>
string(6) "pixels"
}
}
["Category"]=>
string(7) "primary"
}
}
["ItemAttributes"]=>
object(stdClass)#92 (4) {
["Author"]=>
array(2) {
[0]=>
string(11) "Tony Mitton"
[1]=>
string(10) "Ant Parker"
}
["Manufacturer"]=>
string(10) "Kingfisher"
["ProductGroup"]=>
string(4) "Book"
["Title"]=>
string(36) "Amazing Airplanes (Amazing Machines)"
}
}
[2]=>
object(stdClass)#93 (8) {
["ASIN"]=>
string(10) "0061143812"
["DetailPageURL"]=>
string(214) "http://www.amazon.com/In-Cockpit-Inside-History-Making-Aircraft/dp/0061143812%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0061143812"
["ItemLinks"]=>
object(stdClass)#94 (1) {
["ItemLink"]=>
array(7) {
[0]=>
object(stdClass)#95 (2) {
["Description"]=>
string(17) "Technical Details"
["URL"]=>
string(224) "http://www.amazon.com/In-Cockpit-Inside-History-Making-Aircraft/dp/tech-data/0061143812%3FSubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0061143812"
}
[1]=>
object(stdClass)#96 (2) {
["Description"]=>
string(20) "Add To Baby Registry"
["URL"]=>
string(211) "http://www.amazon.com/gp/registry/baby/add-item.html%3Fasin.0%3D0061143812%26SubscriptionId%3DAKIAII3UF3HPAPY3SMDQ%26tag%3Dxxxxxxxxxxxxxxbet-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0061143812"
etc....