2014-09-23 112 views
4

我知道在stackoverflow上会出现类似的问题,但似乎并不适用于我的情况。Facebook Graph API - 已弃用fql的版本v2.1及更高版本

这里是我的代码:

public function fetchFriendDetails($accessToken, $userId) { // echo $accessToken; exit; 
     $curlUrl = 'https://graph.facebook.com/fql?access_token=' . $accessToken . '&pretty=0&q={' . urlencode('"v_1":"select uid,name,birthday_date,username,current_location from user where uid in (select uid1 from friend where uid2=me()) order by birthday_date desc"') . '}'; 

     $ch = curl_init($curlUrl); 
     curl_setopt($ch, CURLOPT_HEADER, 0); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
     $output = curl_exec($ch); 
     curl_close($ch); 

     $intermediate = Util::convertJsonString($output, 'uid', '\,', ','); 
     return Util::convertJsonString($intermediate, 'id', '\,', ','); 
    } 

它给了我下面的输出:

{"error":{"message":"(#12) fql is deprecated for versions v2.1 and higher","type":"OAuthException","code":12}} 

我知道它已经过时https://developers.facebook.com/docs/apps/changelog,但任何人都可以请帮我,我应该在我上面的代码改变,因此它会返回准确的结果?

任何帮助将不胜感激。在此先感谢

回答

3

你需要的,如果你正在使用的令牌通过V2.1应用程序也不会不管你是什么工作,发出特别请求低于2.1

https://graph.facebook.com/v2.0/fql?access_token=

另外一个版本。

+0

感谢您的回复,但我知道它不会工作,但我应该怎么做才能运行检索结果形式此查询 - “从用户选择uid,名称,生日日期,用户名,current_location其中(选择uid1朋友where uid2 = me())order by birthday_date desc' – 2014-09-24 04:35:58

+0

@RakeshShetty你无法检索使用v2.0及以上版本的朋友的完整列表,请参阅changelog.https://developers.facebook.com/docs/apps/changelog – phwd 2014-09-24 10:28:42

+0

This没有帮助,我试图添加V2.0,仍然得到fql已弃用的版本V2.1和更高版本 – 2015-11-29 01:06:51

相关问题