How to parse a facebook graph api response

前端 未结 3 1915
醉酒成梦
醉酒成梦 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:51

    Here is the way:

            $user_profile = (new FacebookRequest(
            $session, 'GET', '/me/albums'
            ))->execute()->getGraphObject();
            $album =  $user_profile->getProperty('data');
    
            $album_data = $album->asArray();//this will do all job for you..
            foreach($album_data as $row){
                var_dump($row);
            }
    

提交回复
热议问题