0

我有一个 Facebook 应用程序,它显示了朋友在 Facebook 上创建的所有事件的计数。我使用 FQL 返回数字。它在 2 月 1 日之前工作正常,我想它由于本月的滚动更改而停止工作,但我无法在文档中找到有关 FQL 协议的任何内容。这是以前的工作:

$timestamp = time(); // Get current Unix time
$iso8601 = date('c', $timestamp); // Convert unix time to ISO8601

// FQL Multiquery
$fql_query = '{"allFriends":"SELECT+uid2+FROM+friend+WHERE+uid1=me()",' 
          .'"allEvents":"SELECT+eid+FROM+event_member+WHERE+uid+IN+(SELECT+uid2+FROM+#allFriends)+AND+start_time>=\''.$iso8601.'\'",'
          .'"creators":"SELECT+creator+FROM+event+WHERE+eid+IN+(SELECT+eid+FROM+#allEvents)"}'
          . '&access_token=' . $access_token;
// Get FQL through Graph API call
    $fql = $facebook->api('/fql?q=' . $fql_query);

但是现在当脚本运行时,我收到了这个异常:

FacebookApiException: OAuthException: (#601) 解析器错误:位置 0 处出现意外的“{”。

我应该改变什么来解决它?

任何帮助将不胜感激

4

2 回答 2

0

Well I never figured out how to fix the multi-query in the question, but I did workout a workaround if anyone is having the same problem. I had to make two separate fql calls and used the output to accomplish my task. Here is the code:

$timestamp = time(); // Get current Unix time
$iso8601 = date('c', $timestamp); // Convert unix time to ISO8601

// FQL Queries
//Select Events created by user's Friends
$fql_query = 'SELECT+creator+FROM+event+WHERE+eid+IN+' .
'(SELECT+eid+FROM+event_member+WHERE+start_time>=\'' . 
$iso8601.'\'+AND+uid+IN+(SELECT+uid2+FROM+friend+WHERE+uid1=me()))' . 
&access_token=' . $access_token;

$fql = $facebook->api('/fql?q=' . $fql_query);

// Get friend_count from user table 
$fql_query2 = 'SELECT+friend_count+FROM+user+WHERE+uid=me()' . 
&access_token=' . $access_token;

$fql2 = $facebook->api('/fql?q=' . $fql_query2);

I know it isn't very efficient and definitely ugly, so if anyone has a way to fix my original problem, I'll gladly accept that answer.

Robert

于 2013-02-10T14:01:07.673 回答
0

这对我有用:

$fql = 'SELECT current_location FROM user WHERE uid = me()';
$result = client->api('/fql', 'GET', ['q' => $fql, 'access_token' => 'access-token-here']);
于 2013-07-04T11:41:40.647 回答