开发者

get application user's info - Facebook-GRAPH API-PHP SDK

开发者 https://www.devze.com 2023-02-24 09:10 出处:网络
i need to dump some info of the application user\'s i am using this code ! $fbme=$facebook->api(\'/me\');

i need to dump some info of the application user's i am using this code !

$fbme     =   $facebook->api('/me');
$str = $fbme['name'].' '.$fbme['sex'].' '.$fbme['hometown_location'].' '.$开发者_JAVA技巧fbme['profile_url'].'\r\n';
$fp = fopen("data.txt", "w");
fwrite($fp, $str);
fclose($fp);

but this only shows the name, nothing else ! why ?


You're making up property names. It's not sex, it's gender. And so on. Read: http://developers.facebook.com/docs/reference/api/user/


    $friends = $facebook->api('me/friends');

    //print_r($friends['data']);
    print_r("Number of friends: ". count($friends['data']));

    foreach ($friends['data'] as $key=>$friendList) {
        echo "<br/>".$key." ".$friendList['name']."<img src='https://graph.facebook.com/".$friendList['id']."/picture' width='50' height='50' title='".$friendList['name']."' />";     
    }
0

精彩评论

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

关注公众号