Facebook fql.query 始终为空结果

发布于 2024-12-09 22:57:37 字数 1030 浏览 0 评论 0原文

我正在编写一个应用程序来查询数十个应用程序的见解;无论我尝试哪个见解表查询,我总是得到一个空结果集。没有错误。其他表(例如页面、应用程序)确实可以正常工作。谁能发现我缺少什么吗?

header('Content-type: text/plain');

//有效:

$q = 'SELECT app_id, api_key, canvas_name, display_name FROM application WHERE app_id="111"';

//无效:

$q = "SELECT metric, value FROM insights WHERE object_id='111' AND metric='page_active_users' AND period='604800' AND end_time='1318615472'";

//代码:

require_once '../../scg_common/facebook/facebook.php';
$facebook = new Facebook(array(
    'appId'  => '111', 
    'secret' => '222', 'cookie' => true, 
    ));
$facebook->getAccessToken();
$facebook->getSignedRequest();

$params = array( 
    'method' => 'fql.query', 'query' => $q, 
//'callback' => null, 'format' => '', 'access_token' => '',
    );

try{
    $result = $facebook->api($params);   }
catch(Exception $o){
    var_dump($o);  }

var_dump($result);

I'm writing an app to query insights for several dozen applications; no matter which of these insights table queries I try, I always get an empty result set. No errors. Other tables (eg page, application,) do work fine. Can anyone spot what I'm missing?

header('Content-type: text/plain');

//WORKS:

$q = 'SELECT app_id, api_key, canvas_name, display_name FROM application WHERE app_id="111"';

//DOESN'T WORK:

$q = "SELECT metric, value FROM insights WHERE object_id='111' AND metric='page_active_users' AND period='604800' AND end_time='1318615472'";

//CODE:

require_once '../../scg_common/facebook/facebook.php';
$facebook = new Facebook(array(
    'appId'  => '111', 
    'secret' => '222', 'cookie' => true, 
    ));
$facebook->getAccessToken();
$facebook->getSignedRequest();

$params = array( 
    'method' => 'fql.query', 'query' => $q, 
//'callback' => null, 'format' => '', 'access_token' => '',
    );

try{
    $result = $facebook->api($params);   }
catch(Exception $o){
    var_dump($o);  }

var_dump($result);

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

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

发布评论

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

评论(2

说好的呢 2024-12-16 22:57:37

您是否尝试过文档中列出的示例?我的意思是确切的字符串?
http://developers.facebook.com/docs/reference/fql/insights/

如果这些不起作用,则可能是因为您没有所需的权限,即 read_insights。

让我知道结果如何。

Have you tried the examples listed on the documentation yet? I mean the exact string?
http://developers.facebook.com/docs/reference/fql/insights/

If those don't work, then it might be because you don't have the required permission, which is read_insights.

Let me know how it turns out.

揽清风入怀 2024-12-16 22:57:37

参数 end_time 需要是有效的 PST 午夜时间戳(根据文档)。我自己的测试显示辅助函数 end_time_date() 不起作用,因此您需要传入时间戳。一旦我解决了这个问题,我就开始获取查询结果。

以下是一些相关的错误:

https://developers.facebook.com/bugs/228141840589755

https://developers.facebook.com/bugs/232510993491615

The parameter end_time needs to be a valid PST midnight timestamp (per the documentation). My own testing shows the helper function end_time_date() does not work, so you need to pass in the timestamp. Once I fixed that, I started getting query results.

Here are some related bugs:

https://developers.facebook.com/bugs/228141840589755

https://developers.facebook.com/bugs/232510993491615

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