I am integrating a payment gateway into my website via an API provided by a third party, and I DID succeed. When it processes the payment and returns a successful result in the so-called success.php page, I receive the already-output xml from their simplexml_load_string($result), which is printed out in the success.php page like this.
SimpleXMLElement Object
(
[error_code] => 00
[token] => 1182263526325de72aw828369e7aa
[description] => SimpleXMLElement Object
(
)
[transaction_status] => 00
[receiver_email] => [email protected]
[order_code] => 3212423
[total_amount] => 200
[payment_method] => SimpleXMLElement Object
(
)
[bank_code] => NLAZ
[payment_type] => 1
[order_description] => SimpleXMLElement Object
(
)
[tax_amount] => 0
[discount_amount] => 0
[fee_shipping] => 0
[return_url] => success.php
[cancel_url] => order.php
[buyer_fullname] => eric phuong
[buyer_email] => [email protected]
[buyer_mobile] => 012108609
[buyer_address] => abc
[affiliate_code] => SimpleXMLElement Object
(
)
[transaction_id] => 12345
)
What I am trying to do are:
Put the output result above into a variable so that I can get the values. How can I do that in a php and with .php? should I put it like this or how?:
< ?php $variable = <<< XML SimpleXMLElement Object ( [error_code] => 00 .... XML; ?>
Try to get ALL the values such as the
buyer_mobile, buyer_email, etcwhich are012108609, [email protected], etc.
Can you help?
Thanks,
Eric
P/S: I also tried to read this entry https://stackoverflow.com/questions/25522047/php-xml-to-array-object-with-attributes-and-values and applied it, but no success.
Note: I already know how to parse the xml file to get the array value, but the process here in this situation is quite different that it is already output and echo'ed out in the success.php page. I TRY TO GET THE VALUES, but it seems to be out of my knowledge.
If the question is not clear enough to you, I can update it as per request.