PHP HTTP_POST_VARS problem

2.4k Views Asked by At

To start: I am a C++ developer who is roped into making a PHP script (for paypal IPN).

I have been incredibly frustrated witht he lack of good working samples from paypal and elsewhere.

The latest problem is that I seem to not get any of the $HTTP_POST_VARS items that I think I should be getting.

Some searches online seem to indicate that this is either deprecated or configurable, etc.

I have no idea what version of PHP is used at my host.

It seems clear that either my testing applications do not post correctly or the script is not working.

so: 2 questions: - Does anyone have any links to working IPN scripts? - What gives with the $HTTP_POST_VARS nonsense?

EDIT

thanks all. I'll try these suggestions out and post up my success story soon I hope.

3

There are 3 best solutions below

1
On

First thing to try is changing $HTTP_POST_VARS to $_POST. That's the new mechanism, and after some version or another $HTTP_POST_VARS stopped being a superglobal.

2
On

You can check what version of PHP you are using by typing phpinfo(); into a PHP script block <?php ?> and see what it ouputs (or simply echo PHP_VERSION).

$HTTP_POST_VARS is the old way of doing things. You can use $_POST['post-var']. To examine everything beint posted, use print_r($_POST).

2
On

As chaos already wrote, just use the $_POST array instead of $HTTP_POST_VAR.
Two things i like to mention:
1. var_dump(somevar) function is very helpful in php. It displays structured information about somevar. If you not sure how is some variable or array or what ever is structured, just use this function. So this call var_dump($_POST); will display you all the current POST parameters.
2. phpinfo() function is helpful if you are interested which version and extensions is your host using. Just create a file with <?php phpinfo(); ?> in it and navigate with the browser to this file. Don't forget to remove it after this, because of the security leak.