Get user's name from Facebook Graph API

后端 未结 5 1695
没有蜡笔的小新
没有蜡笔的小新 2020-12-28 16:40

I would like to know how is it possible to retrieve a string from an external page.

For example: In a PHP website, the user sends a facebook id, ex: 1157251270

5条回答
  •  囚心锁ツ
    2020-12-28 17:29

    you get it by:

    $link = json_decode(file_get_contents('http://graph.facebook.com/1157251270'));
    echo $link->name;
    

    Nice tut: http://webhole.net/2009/08/31/how-to-read-json-data-with-php/

提交回复
热议问题