douji0073 2012-05-03 11:46
浏览 65
已采纳

获取推荐人网址 - 来自Paypal(HTTPS)的访问者

Hi I'm trying to get the referrer url but it doesn't work when the visitor comes to the site from Paypal

$ref = $_SERVER['HTTP_REFERER'];
echo $ref;

Is there a simple way to get the paypal url if the visitor land on the site coming from Paypal ?

Edit and Clarification: I'm not looking to have any special settings on the Paypal site (including but not limited to: IPN, set the return URL, Payment Data Transfer or any other special settings on the Paypal site) All that I'm looking is to get the URL referer when visitors come to the site from Paypal, regardles of the status of a transaction (if there was one).

As pointed by Bob from the manual

$_SERVER is an array containing information such as headers, paths, and script locations. The >entries in this array are created by the web server. There is no guarantee that every web >server will provide any of these; servers may omit some, or provide others not listed here.

So the only question left is - Is there any workaround to this without set something on the paypal site ?

  • 写回答

7条回答 默认 最新

  • dongshuiga2826 2012-05-11 10:46
    关注

    In case your site uses HTTP (not HTTPS) and PayPal uses HTTPS, there is no Referrer being sent!

    HTTP RFC - 15.1.3 Encoding Sensitive Information in URI's states:

    Clients SHOULD NOT include a Referer header field in a (non-secure) HTTP request if the referring page was transferred with a secure protocol.

    So the only way to get the Referrer is to use HTTPS on your site.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?

悬赏问题

  • ¥15 hexo+github部署博客
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?