如何在 fbml 应用程序中访问 facebook 会话 ID?
我正在开发一个可以添加到粉丝页面的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.