0

I'm working on an app and I need to determine if two users are friends. I am performing this task in an AJAX call so redirects would obviously break my AJAX response.

Every time I check to see if I am friends with someone, it acts like my session is expired and redirects me to the login page.

Any help would be most appreciated.

Dennis Day
  • 607
  • 2
  • 5
  • 13

1 Answers1

0

I was able to finally wrap my head around this new Facebook SDK.

Here is my solution:

FacebookSession::setDefaultApplication($appId,$appSecret);

$session = FacebookSession::newAppSession();
$response = (new FacebookRequest( $session, 'GET', '/' . $userId . '/friends?fields=id,installed,name'))->execute()->getGraphObject(GraphObject::className())->asArray();

This gets the result as an array. Well, an array of objects anyway. I hope this helps out anyone else banging their heads.

Dennis Day
  • 607
  • 2
  • 5
  • 13