PHP HTTP_POST_VARS 问题
首先:我是一名 C++ 开发人员,致力于制作 PHP 脚本(用于 paypal IPN)。
我对贝宝和其他地方缺乏良好的工作样本感到非常沮丧。
最新的问题是我似乎没有得到任何我认为我应该得到的 $HTTP_POST_VARS 项目。
一些在线搜索似乎表明这已被弃用或可配置等。
我不知道我的主机使用什么版本的 PHP。
很明显,要么我的测试应用程序未正确发布,要么脚本无法正常工作。
所以:2个问题: - 有人有工作 IPN 脚本的链接吗? - $HTTP_POST_VARS 带来了什么废话?
编辑
谢谢大家。 我会尝试这些建议,并希望尽快发布我的成功故事。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以通过在 PHP 脚本块
中输入
phpinfo();
来检查您使用的 PHP 版本,并查看它的输出(或者简单地)回声PHP_VERSION
)。$HTTP_POST_VARS
是旧的处理方式。 您可以使用$_POST['post-var']
。 要检查发布的所有内容,请使用print_r($_POST)
。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 echoPHP_VERSION
).$HTTP_POST_VARS
is the old way of doing things. You can use$_POST['post-var']
. To examine everything beint posted, useprint_r($_POST)
.首先要尝试的是将 $HTTP_POST_VARS 更改为 $_POST。 这是新机制,在某个版本或另一个版本之后 $HTTP_POST_VARS 不再是超全局的。
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.
正如 Chaos 已经写的那样,只需使用
$_POST
数组而不是$HTTP_POST_VAR
即可。我想提两件事:
1.
var_dump(somevar)
函数在php中非常有帮助。 它显示有关somevar
的结构化信息。 如果您不确定某个变量或数组或其他内容的结构如何,只需使用此函数即可。 因此,此调用var_dump($_POST);
将显示所有当前的 POST 参数。2.
phpinfo()
function 很有帮助,如果您感兴趣的是您的主机使用哪个版本和扩展。 只需使用并使用浏览器导航到该文件。 在此之后不要忘记将其删除,因为存在安全漏洞。
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 aboutsomevar
. If you not sure how is some variable or array or what ever is structured, just use this function. So this callvar_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.