Facebook iFrame应用程序 - 如何使用PHP SDK获取Preload FQL结果? [英] Facebook iFrame app - how to fetch Preload FQL result using PHP SDK?

查看:103
本文介绍了Facebook iFrame应用程序 - 如何使用PHP SDK获取Preload FQL结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从几年以来,我有一个FBML应用程序(一个小的 Flash游戏) m现在试图转换为iFrame应用程序。不幸的是,Facebook iFrame应用程序的文档不多。

since few years I have an FBML app (a small Flash game) which I'm now trying to convert to an iFrame app. Unfortunately there aren't many docs for Facebook iFrame apps yet.

对于我的游戏,我需要用户的名字,图片,性别和城市。

For my game I need the user's first name, picture, gender and the city.

在我的旧版本中,我预装了FQL(由PHP脚本创建):

In my old version I had this preload FQL (created once by a PHP script):

$fql = array('info' => array('pattern' => 'facebook',
    'query' => 'SELECT first_name, sex, pic_big, current_location 
    FROM user WHERE uid={*user*}'));

$fb->api_client->admin_setAppProperties(
    array('preload_fql' => json_encode($fql)));

然后我的FBML应用脚本已经简单如下:

and then my FBML app script had been as simple as:

<?php

require_once('facebook.php');

define('FB_API_ID', 'XXX');
define('FB_AUTH_SECRET', 'YYY');

$fb         = new Facebook(FB_API_ID, FB_AUTH_SECRET);
$viewer_id  = $fb->require_login();
$data       = json_decode($fb->fb_params['info'], true);

$first_name = $data[0][0];
$last_name  = $data[0][2];
$female     = ($data[0][3] != 'male');
$avatar     = $data[0][3];
$city       = $data[0][4]['city'];

# and then I'd just construct flashvars attribute
# for the <fb:swf ...> tag and print it

?>

如何通过iFrame应用程序获取Preload FQL的结果??

Does anybody please have hints on how to recreate the same script for the iFrame version - i.e. how can I fetch the result of Preload FQL by my iFrame app?

根据较早的Facebook博客条目预载FQL应该可以通过iFrame应用访问

According to an older Facebook blog entry Preload FQL should be accessible by the iFrame apps.

谢谢!
Alex

Thank you! Alex

推荐答案

我自己的答案经过长时间的搜索之后,预加载FQL结果不会发送到iframe的Facebook应用程序。

My own answer after long searching is that Preload FQL results aren't sent to iframe Facebook apps.

这就是为什么 Facebook performance doc 说:

预加载FQL查询和多维数据。

"Preload FQL Query and Multiquery.

本节适用于FBML画布页面,但不是网站或IFrame画布页面。

This section applies to FBML canvas pages, but not to websites or IFrame canvas pages."

这篇关于Facebook iFrame应用程序 - 如何使用PHP SDK获取Preload FQL结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆