I'm using the Amazon API to pull info on products. I used this to pull the info:
$response = $amazonEcs->responseGroup('OfferFull')->lookup('B00IXO8I0O');
var_dump($response);
It outputs this (Warning -- long output, you can scroll to the bottom):
I can't figure out how to get the "FormattedPrice." (or any items for that matter)
How can I start pulling data out of that instead of the var_dump().
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(14) "PHP-SOAP/5.5.3"
}
}
["RequestId"]=>
string(36) "3f1671a9-2b85-4905-9362-3f43f5652528"
["Arguments"]=>
object(stdClass)#10 (1) {
["Argument"]=>
object(stdClass)#11 (2) {
["Name"]=>
string(7) "Service"
["Value"]=>
string(19) "AWSECommerceService"
}
}
["RequestProcessingTime"]=>
float(0.015202)
}
["Items"]=>
object(stdClass)#12 (2) {
["Request"]=>
object(stdClass)#13 (2) {
["IsValid"]=>
string(4) "True"
["ItemLookupRequest"]=>
object(stdClass)#14 (4) {
["IdType"]=>
string(4) "ASIN"
["ItemId"]=>
string(10) "B00IXO8I0O"
["ResponseGroup"]=>
string(9) "OfferFull"
["VariationPage"]=>
string(3) "All"
}
}
["Item"]=>
object(stdClass)#15 (3) {
["ASIN"]=>
string(10) "B00IXO8I0O"
["OfferSummary"]=>
object(stdClass)#16 (5) {
["LowestNewPrice"]=>
object(stdClass)#17 (3) {
["Amount"]=>
int(29999)
["CurrencyCode"]=>
string(3) "USD"
["FormattedPrice"]=>
string(7) "$299.99"
}
["TotalNew"]=>
string(1) "1"
["TotalUsed"]=>
string(1) "0"
["TotalCollectible"]=>
string(1) "0"
["TotalRefurbished"]=>
string(1) "0"
}
["Offers"]=>
object(stdClass)#18 (4) {
["TotalOffers"]=>
int(1)
["TotalOfferPages"]=>
int(1)
["MoreOffersUrl"]=>
string(190) "http://www.amazon.com/gp/offer-listing/B00IXO8I0O%3FSubscriptionId%3DAKIAJ4C2HRQEA5R5WQSA%26tag%3Dserineethi-20%26linkCode%3Dsp1%26camp%3D2025%26creative%3D386001%26creativeASIN%3DB00IXO8I0O"
["Offer"]=>
object(stdClass)#19 (3) {
["Merchant"]=>
object(stdClass)#20 (1) {
["Name"]=>
string(19) "UnbeatableSale, Inc"
}
["OfferAttributes"]=>
object(stdClass)#21 (1) {
["Condition"]=>
string(3) "New"
}
["OfferListing"]=>
object(stdClass)#22 (8) {
["OfferListingId"]=>
string(136) "OFsamQIWSTf8O3%2F5DWBmJ633GwRX2m%2FNqcretgjz%2BoyFZJJ6QPbz8tL1YKIBYZZnOAl3AW75luhO6gbvyGV9Rr3fNI9xxUktwSzxDqtZa02RA64n3gRKtV%2BnOlgfINfn"
["Price"]=>
object(stdClass)#23 (3) {
["Amount"]=>
int(38999)
["CurrencyCode"]=>
string(3) "USD"
["FormattedPrice"]=>
string(7) "$389.99"
}
["SalePrice"]=>
object(stdClass)#24 (3) {
["Amount"]=>
int(29999)
["CurrencyCode"]=>
string(3) "USD"
["FormattedPrice"]=>
string(7) "$299.99"
}
["AmountSaved"]=>
object(stdClass)#25 (3) {
["Amount"]=>
int(9000)
["CurrencyCode"]=>
string(3) "USD"
["FormattedPrice"]=>
string(6) "$90.00"
}
["PercentageSaved"]=>
int(23)
["Availability"]=>
string(34) "Usually ships in 4-5 business days"
["AvailabilityAttributes"]=>
object(stdClass)#26 (3) {
["AvailabilityType"]=>
string(3) "now"
["MinimumHours"]=>
int(96)
["MaximumHours"]=>
int(120)
}
["IsEligibleForSuperSaverShipping"]=>
bool(false)
}
}
}
}
}
}
You can access StdClass properties like normal instance variables: $obj->param
. For example, in this case we can access 'FormattedPrice' like this:
echo $response->Items->Item->OfferSummary->LowestNewPrice->FormattedPrice; // $299.99