如何将Facebook对象ID与页面本身的页面配对?
例如,我直接询问了对象ID 325186347604922,我得到了:
<pre>
{
"url": ".../ricetta-bigne_salati.htm",
"type": "ricettepercucinare:recipe",
"title": "Bignè salati",
"image": [
{
"url": ".../magazine/wp-content/uploads/2013/03/101-150x150.jpg",
"width": 150,
"height": 150
}
],
"description": "Gli ingredienti e la procedura per preparare la ricetta Bignè salati.",
"data": {
"course": "Antipasto",
"foreign_id": 130400
},
"updated_time": "2013-03-28T10:12:17+0000",
"id": "325186347604922",
"application": {
"id": "118665634826424",
"name": "Ricettepercucinare.com",
"url": "https://www.facebook.com/apps/application.php?id=118665634826424"
}
}</pre>
但是,例如,此页面http://www.ricettepercucinare.com/ricetta-bigne_salati.htm如何知道自己的ID?
谢谢。
答案 0 :(得分:1)
目前无法从URL中查找对象ID - 尽管它应该是。
应该可以使用:
http://graph.facebook.com/?id=http://www.ricettepercucinare.com/ricetta-bigne_salati.htm
但这不起作用。
请在developers.facebook.com/bugs
中提出错误答案 1 :(得分:0)
这个人的解决方案怎么样:http://blog.odbol.com/?p=9
function facebookGetIdForUrl(url, callback) {
//see http://developers.facebook.com/docs/reference/fql/object_url/
FB.api({
method: 'fql.query',
query: "SELECT id FROM object_url WHERE url = '" + url + "'"
}, function(response) {
callback(response[0].id);
});
}
facebookGetIdForUrl("http://facebook.com", function (id) {
alert("Facebook ID = " + id);
});
答案 2 :(得分:0)
可以使用FQL:
select id, url from object_url where url in ('http://www.watchth.is/movies/9166-baraka')
See it in the Graph API Explorer,或者只是使用此ajax调用:https://graph.facebook.com/fql?q=select%20id%2C%20url%20from%20object_url%20where%20url%20in%20('http%3A%2F%2Fwww.watchth.is%2Fmovies%2F9166-baraka')&format=json&suppress_http_code=1