FQLQuery for recent Facebook API

2020-05-02 08:24发布

问题:

I downloaded the most recent Facebook SDK for PHP. When I want to get information about a post, like the like count, comment count and share count my query works without any problems.

However, when I want to get the friend count of a user it doesn't work and tells me

Facebook\FacebookAuthorizationException: (#12) fql is deprecated for versions v2.1 and higher

Well, I'm not really using the FQL-API. I'm using the graph api and am doing a fql as a parameter there. Like this

https://graph.facebook.com/v2.0/fql?q=SELECT+friend_count+FROM+user+WHERE+uid+%3D+100004262439666&access_token=%ACCESS_TOKEN%

When I paste this address into my searchbar it works without problems. Same goes for the friend count. However, when I'm doing the exact same query via the Facebook PHP SDK I get above exception.

I have multiple methods using the Graph API to make FQL-Requests. In a FB news it states that it is indeed deprecated, but why do some methods still work and some don't?

Won't I be able to get friend count and post information like the comment and like count from a user or facebook page?

As I read the only way to get a friend count is via the fql query, so... yeah...

Any more info on this?

回答1:

Version 2.0 of the Facebook Platform API is the last version where FQL will be available. Versions after 2.0 will not support FQL. Please migrate your applications to use Graph API instead of FQL.

But v2.0 is available until August 7th 2016, the Graph API is not yet suitable for all usages.So you can continue using FQL but need to download Facebook 3.16 https://developers.facebook.com/docs/android/downloads