Facebook Graph API - how to get user country?

后端 未结 10 1637
心在旅途
心在旅途 2020-11-30 02:56

I\'m developing a Facebook application using their Graph API. I have previously developed an app using the deprecated REST API.

I\'ve come across a problem in that

10条回答
  •  Happy的楠姐
    2020-11-30 03:23

    Answer posted by Valerchik is the right one indeed, but in case someone would look for PHP solution, then I ended up with something like this:

    $token = Yii::app()->facebook->getAccessToken();
    $fqlRequest = 'https://api.facebook.com/method/fql.query?query=' .
                  'SELECT%20' . $fqlAttributeName . '%20FROM%20user%20WHERE%20' .
                        'uid=' . $fbUserId . '&access_token=' . $token;
    $ret = file_get_contents($fqlRequest);
    
    if (!empty($ret)) {
        ...
    

    List of all user's attributes can be found here:
    https://developers.facebook.com/docs/reference/fql/user/

    I hope it will help someone :)

提交回复
热议问题