arthrex
asked on
PHP SimpleXML problem
Hi experts,
I try to read xml data from an XML response by using the SimpleXMLElement.
But it doesn't work. When I write the output to a file I can see the response,
but when I try to read single Elements (i.e. FunctionResult) it's always empty.
Where's the mistake?
I try to read xml data from an XML response by using the SimpleXMLElement.
But it doesn't work. When I write the output to a file I can see the response,
but when I try to read single Elements (i.e. FunctionResult) it's always empty.
Where's the mistake?
//THE XML RESPONSE
<?xml version="1.0" encoding="UTF-8"?>
<WIRECARD_BXML xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:noNamespaceSchemaLocation="wirecard.xsd">
<W_RESPONSE>
<FNC_CC_TRANSACTION>
<PROCESSING_STATUS>
<GuWID>C888752122656993575722</GuWID>
<AuthorizationCode></AuthorizationCode>
<Info>THIS IS A DEMO TRANSACTION </Info>
<StatusType>INFO</StatusType>
<FunctionResult>NOK</FunctionResult>
<ERROR>
<Type>DATA_ERROR</Type>
<Number>20071</Number>
<Message>Expiration date invalid.</Message>
<Advice>Expiration date must not be exceeded.</Advice>
</ERROR>
</PROCESSING_STATUS>
</FNC_CC_TRANSACTION>
</W_RESPONSE>
</WIRECARD_BXML>
//MY PHP Script (outpou
$xml = new SimpleXMLElement($output);
$processingResult = $xml -> xpath('//PROCESSING_STATUS');
$isError = $processingResult -> FunctionResult;
$errorMessage = "";
$errorAdvice = "";
echo "isError".$isError; //echo just displays "isError"
//($isError seems to be empty)
<TimeStamp>2008-11-13 10:52:15</TimeStamp>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
https://www.experts-exchange.com/help.jsp#hi403