Use FQL in facebbok api php 4

0

Personally I need to run a simple FQL using Facebook SDK PHP 4 use the following command:

$result=(new FacebookRequest( $session, 'GET', $fql))->execute()->getGraphObject()->asArray()

and it gives me the following error:

  

Fatal error: Uncaught exception 'Facebook \ FacebookAuthorizationException' with message '(# 12) fql is deprecated for versions v2.1 and higher'

I have read that this type of command is already overdue, but I could not find anything to replace it.

How do you get into this new API 2.x now?

I have this code that I found.

$fql="/fql?q=SELECT uid, name,pic_square, birthday_date FROM user WHERE (substr(birthday_date, 0, 2) = '07') AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) order by name&access_token=".$_SESSION["token"];
$session = $this->login();
$result=(new FacebookRequest( $session, 'GET', $fql))->execute()->getGraphObject()->asArray();

How would I do to use it in the new API.

    
asked by anonymous 16.01.2015 / 18:11

1 answer

0

You can get friends' birthday with the following query:

$request = new FacebookRequest(
  $session,
  'GET',
  '/me/friends?fields=friends{id,name,birthday}'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();

For this you need the authorization user_friends .

Note that since version 2.0 of the API this call will only return the user's friends who also use your application.

Unfortunately, as far as my knowledge goes, there is no way to filter the anniversary date directly from the call, you will need to iterate the response elements and filter client-side dates.

    
16.01.2015 / 19:27