用jquery获取Facebook页面Feed作为json [英] get facebook page feed as json with jquery
问题描述
$ .getJSON(https://www.facebook.com/feeds/ page.php?id = 237173582992285& format = json& callback =?,function(results){
console.log(results);
});
我也创建了一个jsfiddle与整个代码。如果需要,请查看 - > http://jsfiddle.net/yZn7N/ 。
我可以看到所有的json数据,如果我去指定的链接,他们得到提取,我不知道是什么导致无效的标签错误。任何一种帮助修复或解释为什么会发生这种情况将非常感激。
您需要使用Facebook图API为此发生。
https://developers.facebook.com/docs/reference/api/page/#feed
您的来电应更改为:
https: //graph.facebook.com/237173582992285/feed?access_token=YOUR-TOKEN-GOES-HERE
您可以尝试使用此测试页面,并尝试熟悉图表api。
https://developers.facebook.com/tools/explorer/?method=GET&path=237173582992285%2Ffeed
编辑:
您还可以从页面获取几种格式的墙。
JSON
https://www.facebook.com/feeds/page.php?format=json&id=237173582992285
ATOM
https://www.facebook.com/feeds/page.php?format=atom10&id=237173582992285
RSS
https://www.facebook.com/feeds/ page.php?format = rss20& id = 237173582992285
I have been trying to get facebook page feed from json data with jquery. so far I have been able to get page details with my method but when I try to get page's feed it gives me an error and in the console it says "syntax error: invalid label". this is my code.....
$.getJSON("https://www.facebook.com/feeds/page.php?id=237173582992285&format=json&callback=?", function(results){
console.log(results);
});
I also have created a jsfiddle with the whole code. check it out if required -> http://jsfiddle.net/yZn7N/. I can see all the json data if I go to the specified link and they do get fetched and I'm not sure what's causing the invalid label error. Any kind of help fixing it or explanation of why this is happening will be gratefully appreciated.
You need to use the Facebook Graph API for this to happen.
https://developers.facebook.com/docs/reference/api/page/#feed
Your call should change to:
https://graph.facebook.com/237173582992285/feed?access_token=YOUR-TOKEN-GOES-HERE
You can try use this test page and try to familiarize with the graph api.
https://developers.facebook.com/tools/explorer/?method=GET&path=237173582992285%2Ffeed
EDIT:
You can also get the Wall from the page in several formats.
JSON https://www.facebook.com/feeds/page.php?format=json&id=237173582992285
ATOM https://www.facebook.com/feeds/page.php?format=atom10&id=237173582992285
RSS https://www.facebook.com/feeds/page.php?format=rss20&id=237173582992285
这篇关于用jquery获取Facebook页面Feed作为json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!