Link to home
Start Free TrialLog in
Avatar of BR
BRFlag for Türkiye

asked on

php simplexml_load_string function

Dear Experts,
the below code, it works perfectly fine,

$xmlDATA = '<?xml version="1.0" encoding="utf-8"?><VposResponse><MerchantId>000000000125427</MerchantId><TransactionType>Sale</TransactionType></VposResponse>';

$xml = simplexml_load_string($xmlDATA);

echo $MerchantId = $xml->MerchantId;
echo "<br><br>";
echo $TransactionType = $xml->TransactionType;

Open in new window


however it doesn't work, altough it is the same data.

 $xmlDATA = htmlentities($_POST["BankResponse"]);


$xml = simplexml_load_string($xmlDATA);

echo "MerchantId :" .  $MerchantId = $xml->MerchantId;
echo "<br><br>";
echo "TransactionType :" . $TransactionType = $xml->TransactionType;

Open in new window


I don't understand why it is not working. what do you suggest I should do?
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BR

ASKER

thank you Julian Hansen, you are great
You are welcome.