Forum Moderators: coopster

Message Too Old, No Replies

2checkout.com script passback problem

         

isorg

2:59 pm on May 7, 2004 (gmt 0)

10+ Year Member



I wonder whether anyone could help me out with this problem...
I have a 2checkout.com account which passes back variables after a sale to my PHP script. This has been working absolutely fine for ages. I now have a new server, and the problem is that the PHP script can no longer access the passback variables.

The old server ran PHP 4.1.2 whereas the new server runs PHP 4.3.3. Presumably, the problem is due to register globals being off on the new server, but I still can't get the script to work.

In the script, I refer to the passback variables directly e.g. echo $merchant_order_id; Interestingly, if I call the script directly from the command line with?merchant_order_id=x, it recognises it. But try that same thing from the 2checkout payment system, and it gives a blank.

Any ideas?

ergophobe

3:50 pm on May 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



[edit] I reread you post. It seems that your server does have register_globals on (since you can get GET params from a typed-in URL). Therefore, it probably is something else. Try putting this right at the top of your script.

echo "<pre>\n";
print_r($_GET);
print_r ($_POST);
echo "</pre>\n";
exit;

Note that if the script that sends the form is the same as the one that receives it, you would need to open the page, then change and upload the new PHP file, then submit the form.
[/edit]

[old incorrect stuff]
My guess is that the new server has register_globals off (as it should) but the script is written to expect it to be on (which is bad). You can run phpinfo() on the new server and see whether register globals is on or off.

If that is correct, instead of $myvar, you need to access it via $_GET['myvar']

The easy solution for the near term would be to put a .htaccess file in your site root with the line

php_flag register_globals on

[/old incorrect stuff]

isorg

6:15 pm on May 7, 2004 (gmt 0)

10+ Year Member



When I place that at the top, this is the reply from the script...

Array
(
)
Array
(
)

When I try that with the old script, it returns the passback variables in the brackets... the scripts are totally identical, just on different servers. If it would help I can paste the phpinfo results from each server...

ergophobe

7:21 pm on May 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



okay, so that means the problems are not on that page. So

Old server:
- submit form on page
- sends post/get vars to page or other_page
- process get/post information

New server:
- submit form on page
- does NOT sends post/get vars to page or other_page
- can't process info

So the problem is happening at some point before the page that you are having trouble with. There is no data to deal with, so it can't deal.

You need to move upstream and try to figure out whether the form is actually submitting any data and where it is going.

isorg

11:58 pm on May 8, 2004 (gmt 0)

10+ Year Member



I have solved the problem! In your 2checkout.com account you have to specify the filename which you want it to passback to after the sale. I had taken the opportunity to rename the PHP script to .html rather than .php for all the scripts on the new server. For whatever reason, this caused the problem. The script now works fine after calling it .php again.