views:

23

answers:

0

Hi,

I have 2 web apps running on the same server. I tested the following on localhost so far, but I am really curious as to whether there was any fundamental issues with this implementation.

Let us call these apps Shopping.com and Checkoutshopping.com.

When a user on shopping.com clicks on a PayPal button, I will trigger a function; the function's pseudo code is like this:

function moveToPayPal() {
    // use curl to POST some data to function in checkoutshopping.com called track
    // will use the results from that curl POST and then redirect to paypal.com
}

In the meantime the pseudocode for track in checkoutshopping.com is:

function track() {
    // will use the data from moveToPayPal and do some processing
    // will now write to session variable.
    // return results
}

Now the user is directed to paypal.com from moveToPayPal. He finishes up and is redirected by paypal.com to checkoutshopping.com and goes to another function called confirm:

function confirm() {
    // will need to read the session variable written in track
    // do further processing...
}

Now here comes the problem. In confirm, I cannot read the session variable written in the function track which is weird considering that both confirm and track are in the same web app.

Please note the following:

1) I am not trying to access session of shopping.com while doing processing in checkoutshopping.com (I got a lot of replies from people saying I am doing this. I don't think that I am doing this. If for some reason, you think I am mistaken, please state so clearly.)

2) Please do not ask me why I am splitting the processing between 2 app. This is a long story that will only waste more space.

3) I have already resolved my issue (ironically enough with regards to point 1) by deliberately sharing session variables between the 2 apps using database. So please do NOT offer a workaround like this.

4) The reason I am asking this question despite having it resolved with a workaround is because I AM really curious why the original way did NOT work. Secondly, of course, I think the workaround is not as elegant as the original way. I want to improve my knowledge in this area of web programming.

Thank you.