How do you get a facebook user's information and insert it into a database?

后端 未结 4 1121
故里飘歌
故里飘歌 2021-01-30 11:47

I wasn\'t sure how to ask it, but I am trying to teach myself how to create a program that uses the graph api. Most of the tutorials I have seen are older, and I don\'t know ho

4条回答
  •  梦毁少年i
    2021-01-30 12:47

    Considering that you are using the PHP SDK Classes provided by Facebook here

    You can do something like this

    $fb = new Facebook(array(
         'appId' => 'YOUR_APP_ID',
         'secret' => 'YOUR_APP_SECRET'
    ));
    
    
    $userData = $fb->api('/me','GET');
    $userData = serialize($userData);
    
    //now userdata is a string, so, insert into the database.
    

    Remembering, in your app configurantion, you must specify the kind of information you want from user.

提交回复
热议问题