PHP HTTP 引荐来源网址
我有一个接受来自远程站点的 POST 的页面。我想检测这些帖子来自的域。我意识到它可以被欺骗,但总比没有好。 我尝试访问 HTTP_REFERER 变量,但它只返回 null。
该页面接受来自 PayPal(即时付款通知)和其他支付网关等来源的 POST。
我怎样才能接到推荐电话?
I have a page which accepts POSTs from a remote site. I would like to detect the domain that these POSTs are coming from. I realize that it can be spoofed but it is better than nothing.
I have tried accessing the HTTP_REFERER variable but it just returns null.
The page accepts POSTs from sources like PayPal (instant payment notifications) and other payment gateways.
How can I get the referring call?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您拼写的 Referer 正确。应该是:
You spelled Referer correctly. It should be:
使用单个 R,请尝试 var_dump($_SERVER) 以获取更多信息。
with a single R, try var_dump($_SERVER) for more info.
您是对的,推荐人很容易被欺骗,但是有更好的解决方案。阅读 ipn 文档,其中他们提到了验证机制。永远不要相信用户。
You are right that the referrer is easy to spoof, however there is a better solution. Read the ipn documentation in which they mention validation mechanisms. Never trust the user.
这对我来说非常有效:
https://stackoverflow.com/a/17958676/2635701
This works for me pretty well:
https://stackoverflow.com/a/17958676/2635701