Session variables passed through second server...??


#1

I’m trying to pass an array defined in $_SESSION through a page on a second server.

What I have now looks like this:

session_start(); $_SESSION[order] = array(blah,blah,blah);

Then I call a script (https://www.otherserver.com/pay.php) to process payment by a 3rd party and in the passback I call the following:

include("http://www.myserver.com/mailinfo_include.php");

mailinfo_include.php:

session_start(); $ordered = $_SESSION[order];

The problem is that the included script (which is processed on myserver) does no longer see the session array. I’m stuck here… I’d really appreciate some feedback!

Thanks!!


#2

It’s not really possible since the session is attributed to a single user. If a server accesses a page, a new session will be created, unless the session ID is being specified. By redefining the session handlers, you can probably manage to save the sessions differently (such as in a database) and get more control over them.

Can you explain a bit more what you are trying to achieve?


#3

I was just checking the knowledge base of the 3rd party payment processor again, and I ran into this (don’t know if it’ll help):

[i]The direct return works through a spider on otherserver.com that does an HTML GET from our server with all the variables to the seller’s server. The spider prints to the screen whatever the seller’s server returns for the buyer to see.

The Return script should not be designed to accept the return fields in the POST method, but with the Direct Return turned on, the fields are passed in the GET method. Also with the Direct Return, the image and link URLs need to be full paths, not relative paths.[/i]


#4
Can you explain a bit more what you are trying to achieve?

Of course!

I’m trying to build a site with a small shopping cart system based on the session array (no database or cookies, well except for the PHPSESSID). The payment processor get the total price for the order and charges the customers cc. After that I want to send the customer and the shop emails with address info from the form on otherserver.com and the info in my session array (items that the customer ordered) from myserver.com

Hope this carifies my question…


#5

I know I can pass variables through the otherserver.com routine. My next problem then is that I can’t figure out how to post an array… I tried with session_encode() but than the html parser chokes on the double quotes in the string…


#6

Payment processing systems usually recieve an invoice number and an amount. You will probably need a database to store your invoice numbers and the content of the order, unless you can send a description along with the amount (so you can track and mail the orders).

You sould verify on exactly what you have to send to the payment processor and what he will return you.