解析facebook json feed

时间:2017-04-16 18:08:37

标签: json facebook foreach

Facebook返回的json-feed很难解码为单独的参数。看不出我在这里做错了什么....

<?php 

$request_url ="https://graph.facebook.com/posts?ids=VGardena,obertauern&access_token=EAACx6A6Hb9cBAB8tomDGj9N1FpE2xcWMVE7ad0Y2q08XUjVmGXsQ2aPCEKbX0iiRxK6M6FWYl1os3I2k5ZC1uY2cnJ1bZB2He3KTOpbwNo9KAZAzweShCUFvOt9Nfb2jZB8gHZCiO8l66dxsqdMCAbgxIlkTqJ8EZD&limit=2";
$requests = file_get_contents($request_url);

$fb_response = json_decode($requests,true);



foreach($fb_response as $item){

echo 'Message: ' . $item->message . '<br />';//there is no name returned on a comment
echo 'From ID: ' . $item->from->id . '<br />';
 echo 'Message: ' . $item->message . '<br />';
 echo 'Timestamp: ' . $item->created_time . '<br /><br />';
}

?>

0 个答案:

没有答案