hungryfrank Posted August 3, 2017 Share Posted August 3, 2017 i am having a problem parsing the file that ebay returns for error codes $results = new SimpleXMLElement($responseXml); if ( $results->Errors != null ) foreach ($results->Errors as $key => $value) { $longMsg =$results->Errors->LongMessage; $shortMsg = $results->Errors->ShortMessage; $code = $results->Errors->ErrorCode; echo '<P>' . $code . ' : ' . str_replace( ">", ">", str_replace( "<", "<", $shortMsg ) ); if ( $longMsg != '' ) echo '<BR>' . str_replace( ">", ">", str_replace( "<", "<", $longMsg ) ); } echo "<br>"; } but i get the same entery repeated again. here is XML file SimpleXMLElement Object ( [Timestamp] => 2017-08-03T19:38:29.478Z [Ack] => Warning [Errors] => Array ( [0] => SimpleXMLElement Object ( [ShortMessage] => Unrecognized element <ActiveList.EntriesPerPage> in request message. [LongMessage] => The element <ActiveList.EntriesPerPage> was found in the input request message. This is not a declared element in the schema and will be ignored. [ErrorCode] => 21927 [SeverityCode] => Warning [ErrorParameters] => SimpleXMLElement Object ( [@attributes] => Array ( [ParamID] => 0 ) [Value] => ActiveList.EntriesPerPage ) [ErrorClassification] => RequestError ) [1] => SimpleXMLElement Object ( [ShortMessage] => Unrecognized element <ActiveList.PageNumber> in request message. [LongMessage] => The element <ActiveList.PageNumber> was found in the input request message. This is not a declared element in the schema and will be ignored. [ErrorCode] => 21927 [SeverityCode] => Warning [ErrorParameters] => SimpleXMLElement Object ( [@attributes] => Array ( [ParamID] => 0 ) [Value] => ActiveList.PageNumber ) [ErrorClassification] => RequestError ) ) Quote Link to comment https://forums.phpfreaks.com/topic/304499-problem-with-parsing-xml/ Share on other sites More sharing options...
Solution Jacques1 Posted August 3, 2017 Solution Share Posted August 3, 2017 Do you see any references to $key or $value in your loop? Me neither. Then how do you expect to get the entries? If you don't remember how loops work, relearn the PHP basics before you start any complex project. Quote Link to comment https://forums.phpfreaks.com/topic/304499-problem-with-parsing-xml/#findComment-1549235 Share on other sites More sharing options...
hungryfrank Posted August 3, 2017 Author Share Posted August 3, 2017 yes thanks Quote Link to comment https://forums.phpfreaks.com/topic/304499-problem-with-parsing-xml/#findComment-1549242 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.