var_dump($parsed_xml);
echo $parsed_xml->OperationRequest->Errors->Error[0]->Code;
echo $parsed_xml->xpath('//Code');
I do the var_dump so you can see the simple xml. OperationREquest is the root. The path Errors->Error->Code is at the bottom of the var_dump. The path looks right to me. I tried getting Code with xpath function and with the simple_xml. How do I get the error message and code? I tried everything.
I want the code and the message at the bottom. But I'm getting this error message:
Notice: Trying to get property of non-object in /Library/WebServer/Documents/lexsource14.php on line 46
Array
-----xml------
object(SimpleXMLElement)#1 (2) { ["OperationRequest"]=> object(SimpleXMLElement)#2 (3) { ["RequestId"]=> string(36) "73322e47-9808-4d8e-84a4-bcba1561a3be" ["Arguments"]=> object(SimpleXMLElement)#4 (1) { ["Argument"]=> array(8) { [0]=> object(SimpleXMLElement)#5 (1) { ["@attributes"]=> array(2) { ["Name"]=> string(9) "Operation" ["Value"]=> string(10) "ItemLookup" } } [1]=> object(SimpleXMLElement)#6 (1) { ["@attributes"]=> array(2) { ["Name"]=> string(7) "Service" ["Value"]=> string(19) "AWSECommerceService" } } [2]=> object(SimpleXMLElement)#7 (1) { ["@attributes"]=> array(2) { ["Name"]=> string(9) "Signature" ["Value"]=> string(44) "9QJFphezFTTo/eoVg+SryrMJds6V5FOcV/bM50I3tNY=" } } [3]=> object(SimpleXMLElement)#8 (1) { ["@attributes"]=> array(2) { ["Name"]=> string(7) "Version" ["Value"]=> string(10) "2009-01-06" } } [4]=> object(SimpleXMLElement)#9 (1) { ["@attributes"]=> array(2) { ["Name"]=> string(6) "ItemId" ["Value"]=> string(8) "B000BUR1" } } [5]=> object(SimpleXMLElement)#10 (1) { ["@attributes"]=> array(1) { ["Name"]=> string(11) "IdType-ASIN" } } [6]=> object(SimpleXMLElement)#11 (1) { ["@attributes"]=> array(2) { ["Name"]=> string(14) "AWSAccessKeyId" ["Value"]=> string(20) "AKIAIETJLADYILLAACBA" } } [7]=> object(SimpleXMLElement)#12 (1) { ["@attributes"]=> array(2) { ["Name"]=> string(9) "Timestamp" ["Value"]=> string(20) "2010-05-21T20:36:06Z" } } } } ["RequestProcessingTime"]=> string(18) "0.0061740000000000" } ["Items"]=> object(SimpleXMLElement)#3 (1) { ["Request"]=> object(SimpleXMLElement)#13 (3) { ["IsValid"]=> string(4) "True" ["ItemLookupRequest"]=> object(SimpleXMLElement)#14 (10) { ["Condition"]=> string(3) "New" ["DeliveryMethod"]=> string(4) "Ship" ["IdType"]=> string(4) "ASIN" ["MerchantId"]=> string(6) "Amazon" ["OfferPage"]=> string(1) "1" ["ItemId"]=> string(8) "B000BUR1" ["ResponseGroup"]=> string(5) "Small" ["ReviewPage"]=> string(1) "1" ["ReviewSort"]=> string(15) "-SubmissionDate" ["VariationPage"]=> string(3) "All" } ["Errors"]=> object(SimpleXMLElement)#15 (1) { ["Error"]=> object(SimpleXMLElement)#16 (2) { ["Code"]=> string(25) "AWS.InvalidParameterValue" ["Message"]=> string(90) "B000BUR1 is not a valid value for ItemId. Please change this value and retry your request." } } } } }
THANKS,