如何在 fbml 应用程序中访问 facebook 会话 ID?

发布于 2024-12-22 15:36:43 字数 609 浏览 3 评论 0原文

我正在开发一个可以添加到粉丝页面的 fbml 应用程序。然后应用程序将 ajax 请求发送到我的 php 脚本以获取数据等。 我必须在我的 php 端针对密钥或在整个 facebook 会话期间保持不变的东西存储一些数据。我怎样才能实现这个?有没有办法在ajax请求中发送facebook会话id?我正在使用 fbml Ajax() 元素发送 ajax 请求。 这是代码的一瞥

function do_ajax(path)
{   
    var sessionKey = '###'; //Something representing fbml app's session state
    var ajax = new Ajax();
    ajax.responseType = Ajax.FBML;
    ajax.ondone = function(data) {      
        document.getElementById('content').setInnerFBML(data);
    }  
    ajax.post(path+'/'+sessionKey);
}

访问者可能已登录,也可能未登录,因此我无法使用用户 ID。并且 php session id 在每个请求中不断变化。 多谢

I am working on an fbml application which can be added to a fan page. The application then sends ajax request to my php script for data etc.
I have to store some data on my php side against a key or something which remains the same throughout facebook session. How can I implement this? Is there any way to send facebook session id in ajax request? I am using fbml Ajax() element to send ajax request.
Here's a glimpse of code

function do_ajax(path)
{   
    var sessionKey = '###'; //Something representing fbml app's session state
    var ajax = new Ajax();
    ajax.responseType = Ajax.FBML;
    ajax.ondone = function(data) {      
        document.getElementById('content').setInnerFBML(data);
    }  
    ajax.post(path+'/'+sessionKey);
}

The visitor may or may not be logged in so I can't use userid. And php session id keeps changing in each request.
Thanks a lot

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晚风撩人 2024-12-29 15:36:43

FBML 已被弃用。请参阅:https://developers.facebook.com/docs/reference/fbml/ 10 天后不再支持它,然后 6 个月后它将不再起作用。我建议使用新的 Javascript SDK。

FBML is being deprecated. See: https://developers.facebook.com/docs/reference/fbml/ No more support for it in 10 days, and then in 6 months it will no longer work. I would suggest using the new Javascript SDK.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文