Monday, January 10, 2022

[FIXED] Facebook api call in php returns empty

Issue

I have result of $result = $facebook->api($params); How to extract information from it? Cant decode it using json_decode, gets an error the parameter is string. Searched a lot for the solution, couldn't find any related information.

EDIT

$params = array(

 'method' => 'fql.query',
 'query' => "SELECT uid,pic_square,name,devices FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())",
    );
  $result = $facebook->api($params);

Could this return empty? Without showing any error? What am I doing wrong?


Solution

Turns out, I was testing it using a test user which had no friends. That was the reason why the response was an empty array.



Answered By - ben_joseph

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.