我一直在尝试从返回的此XML的Amount
区域获取LandedPrice
。我试过这个和其他类似的代码。有人会对我如何从中获取这些信息提出任何建议吗?
$simplexml = new SimpleXMLElement($response); // Is response from server.
$amount = (string) $simplexml->CompetitivePrice[0]->LandedPrice->Price->Amount;
SimpleXMLElement Object
( [GetCompetitivePricingForASINResult] => SimpleXMLElement Object
( [@attributes] => Array ( [ASIN] => B00H9M9B34 [status] => Success ) [Product] => SimpleXMLElement Object
( [Identifiers] => SimpleXMLElement Object
( [MarketplaceASIN] => SimpleXMLElement Object
( [MarketplaceId] => ATVPDKIKX0DER [ASIN] => B00H9M9B34 )
) [CompetitivePricing] => SimpleXMLElement Object
( [CompetitivePrices] => SimpleXMLElement Object
( [CompetitivePrice] => SimpleXMLElement Object
( [@attributes] => Array ( [belongsToRequester] => false [condition] => New [subcondition] => New ) [CompetitivePriceId] => 1 [Price] => SimpleXMLElement Object
( [LandedPrice] => SimpleXMLElement Object
( [CurrencyCode] => USD [Amount] => 75.00 ) [ListingPrice] => SimpleXMLElement Object
( [CurrencyCode] => USD [Amount] => 75.00 ) [Shipping] => SimpleXMLElement Object
( [CurrencyCode] => USD [Amount] => 0.00 )
)
)
) [NumberOfOfferListings] => SimpleXMLElement Object
( [OfferListingCount] => Array ( [0] => 1 [1] => 1 ) )
) [SalesRankings] => SimpleXMLElement Object
( [SalesRank] => SimpleXMLElement Object
( [ProductCategoryId] => sports_display_on_website [Rank] => 625877 )
)
)
)
[ResponseMetadata] => SimpleXMLElement Object
( [RequestId] => 234234343d-bawff3f3-vef5555rrer)
)