How to parse a facebook graph api response

前端 未结 3 1917
醉酒成梦
醉酒成梦 2021-01-15 09:47

I have a facebook graph api request which brings back this response

Facebook\\GraphObject Object
(
    [backingData:protected] => Array
        (
                 


        
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-15 09:56

    For the New version Graph API v2.5 of Facebook Read read data as below :

    $fb = new \Facebook\Facebook([
            'app_id' => 'KEY HERE',
            'app_secret' => 'SECRET HERE',
            'default_graph_version' => 'v2.5',
        ]);
     $asscee_t ="ACCESS TOKEN HERE";
        $response = $fb->get('/me/friends', $asscee_t);
            $get_data = $response->getDecodedBody(); // for Array resonse
            //$get_data = $response->getDecodedBody(); // For Json format result only
            echo $get_data['summary']['total_count']; die; // Get total number of Friends
    

提交回复
热议问题