解析Facebook评论图API

时间:2011-04-19 06:50:02

标签: php json facebook comments

我一直在寻找一种方法来正确解析PHP中JSON对象或类似facebook提要的关联数组:

https://graph.facebook.com/comments/?ids=http://lovebryan.com/friends/layne/data/upimages/ClevelandForest.jpg

$request_url ="https://graph.facebook.com/comments/?ids=" . $purl;
$requests = file_get_contents($request_url);
$fb_response = json_decode($requests);

如何在PHP中实现foreach函数来提取每个数据成员的id?

1 个答案:

答案 0 :(得分:0)

$fb_response = json_decode($json, true);

foreach($fb_response as $key => $value)
{
     // your code....
}