Facebook $facebook->getSignedRequest();和signed_request错误

发布于 2025-01-08 12:29:32 字数 1106 浏览 0 评论 0原文

我正在使用 getSignedRequest();和signed_request来检查访问者是否喜欢该页面。

当我转到“页面”选项卡时,它会在 iframe 中显示一个外部网站 getSignedRequest();和signed_request正确提取信息并将其显示在我的index.php页面上。但是一旦我喜欢(或不喜欢该页面)甚至执行 window.location.reload(); -或者当我离开index.php页面并再次返回时,getSignedRequest();并且signed_request不会触发。当我导航到 index.php 并手动刷新浏览器时, getSignedRequest();和signed_request火,一切都很好。

有谁知道我可能做错了什么?为什么 getSignedRequest();和signed_request只触发一次?

这是有问题的页面:

http://www.facebook.com/pages/RT/367570243261944?sk=app_327979357253049

我已经尝试过这两种方法:

$signed_request = $facebook->getSignedRequest();

if (isset($_REQUEST['signed_request'])) {
    $encoded_sig = null;
    $payload = null;
    list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2);
    $sig = base64_decode(strtr($encoded_sig, '-_', '+/'));
    $signed_request = json_decode(base64_decode(strtr($payload, '-_', '+/'), true),true);
} else {
    echo "ERROR";
}

谢谢!

I am using getSignedRequest(); and signed_request to check wether or not a visitor likes the page.

When i go to my Page Tab, that shows an external website in the iframe, getSignedRequest(); and signed_request pulls the information correctly and shows it on my index.php page. But once i like (or dislike the page) and even do a window.location.reload(); - or when i navigate away from the index.php page and back to it again, getSignedRequest(); and signed_request do not fire. When i navigate to my index.php and do a manual refresh of my browser, getSignedRequest(); and signed_request fire and everything is fine.

Does anyone know what i might be doing wrong? Why does getSignedRequest(); and signed_request only fire once?

Here's the Page in question:

http://www.facebook.com/pages/RT/367570243261944?sk=app_327979357253049

I have tried both of these methods:

$signed_request = $facebook->getSignedRequest();

and also

if (isset($_REQUEST['signed_request'])) {
    $encoded_sig = null;
    $payload = null;
    list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2);
    $sig = base64_decode(strtr($encoded_sig, '-_', '+/'));
    $signed_request = json_decode(base64_decode(strtr($payload, '-_', '+/'), true),true);
} else {
    echo "ERROR";
}

Thank You!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文