XML : Getting Items inside of XML Tag [duplicate]

This question is an exact duplicate of:

I am working on a project with the Amazon API and I am trying to get the status of a call.

  <GetMatchingProductForIdResult Id="082686516020" IdType="UPC" status="Success">    

if status="Success" I would like to finish the rest of the code. If status="Success" is not true then continue. So far I have wrote this code:

  //$xml consists of an open file.  if($xml->GetMatchingProductForIdResult['staus'] === 'Success'){  //Execute the rest of normal code  } else {      continue;  }    

I am not sure if that is the proper way to write what I am trying to do, but no errors have occurred.

The XML file opens, I have already checked that. The only problem that I am having is that when it does not catch that there is a client error. I have used print_r($xml->GetMatchingProductForIdResult); It prints

  <GetMatchingProductForIdResult Id="upc" IdType="UPC" status="ClientError">    

What code allows me to ignore this problem and continue on in the for loop that it is in?

If someone could help me out, I would really appreciate it. Thanks.

No comments:

Post a Comment