开发者

Facebook PHP SDK query returns an empty array

开发者 https://www.devze.com 2023-02-28 22:46 出处:网络
my problem is when I try to get the pic_square and pic_big from the user connected to my application and I get an empty array. This is the code:

my problem is when I try to get the pic_square and pic_big from the user connected to my application and I get an empty array. This is the code:

$facebook = new Facebook(array(
        'appId'  => FBAPPID,
        'secret' => FBSECRETNUMBER,
        'cookie' => true,));

$user_info = $facebook->api(array(
        'method'     => 'fql.query',
        'query'     => "SELECT pic_square, pic_big FROM user WHERE uid = me()",
        'callback'    => ''
    ));

During the login process I run the same code and it works, but later when I try to 开发者_C百科implement a function to synch the user picture with FB pic I get no error and no data. Any idea what is the problem?

Thanks a lot.


My guess is that later the facebook session doesn't exist so you don't have an access token to call the FQL query.

Anyway, why are you using FQL to get those pictures? You can always get them like this:

http://graph.facebook.com/me/picture?type=large or http://graph.facebook.com/me/picture?type=square

Or you can use the user id to get permanent links to the images:

http://graph.facebook.com/USER_ID_HERE/picture?type=square

Good luck

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号