Jump to content

Displaying returned XML in another PHP page


cobalt30

Recommended Posts

I have an online payment form that will return XML given if a payment is successful or declines.  I am using PHP cURL to do this, and it all works from the standpoint of approving or denying transactions.  However, what I want to do is have it redirect to a new page and display the output in a regular format (minus the XML brackets and such), but cannot get it to carry the data over from the processing page to the results page.

 

This is the tag I'm using in the processing page to direct when a payment is successful:

 

Header("Location: /Approved.php?approvalcode=" . $xdoc2->approvalcode . "");

 

Currently it is passing just the approval code in the URL, but I am going to expand on this after I get the page working properly.  Let's say this is part of my XML response I get back when I hit the server and post all the values it is looking for:

 

[errorcode] => 0 [errordesc] => Successful. [responsecode] => 1 [response] => 1 - APPROVED [approvalcode] => 766251

 

What needs to be coded in the Approved.php page to ensure these values are captured and displayed?  This is an HTTPS setup, and from what I've read $_SESSION probably isn't the way to go (unless I'm told otherwise here), and I do not at all want to use cookies unless I have no choice.  I've tried echo statements and $_GET statements but nothing is working, and I know it's because I'm missing something but cannot figure out what.

When you tag something onto the url as you did its a get. So on the approval page if it is called by your header location redirect $_GET['approvalcode'] would be your xml. Any others like ?approvalcode=xxx&validate=yyy&rejectreason=zzz

would be

$_GET['validate

$_GET['rejectreason']

 

 

HTH

Teamatomic

That does work for the approvalcode, thank you.  My question, however, is are there any ways to have values show up in the approval.php page without stringing them in the URL?  I don't want all of the responses from the XML to show up in the URL, unless I have to do it that way.  This is for no other reason than personal preference, so if that is all I can do then that is all I can do, but if there is another way to get these fields without URL strings, how would I go about it?

You can use session to keep the data. I think in your concern about using sessions is related more to security that the transfer/storage of persistent data. If you are truly concerned about the session security you can destroy the session after you retrieve that data.

 

 

HTH

Teamtomic

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.