Determine Object_ID of a URL to use with the Facebook Open Graph

ε祈祈猫儿з 提交于 2019-12-20 10:14:24

问题


I am trying to learn how to use the Facebook Open Graph API and have a question on how to determine the object_id of my site. I need this object_id so that I can do other queries, such as I want to get a list of users who have liked my site within a given time period.

Based on other Stackoverflow questions I have seen that I should be able to run this query to get the object_id

select id from object_url where url in ('www.bubbasgameroom.com', 'bubbasgameroom.com')

When I run that query it comes back with an empty result. When I run the following query, I see that my page has been liked 21 times

select total_count from link_stat where url in ('www.bubbasgameroom.com', 'bubbasgameroom.com')

What am I missing here? Any help will be greatly appreciated.
Thanks!


回答1:


Most likely the url should be identical to the og:url meta tag if used on your website. Also you need to append the http:// part for it to work. For example this would work:

SELECT url,site,id 
FROM object_url 
WHERE url IN ( 
    'http://developers.facebook.com',
    'http://www.imdb.com/'
)

Result:

[
  {
    "url": "http://developers.facebook.com",
    "site": "developers.facebook.com",
    "id": 113167538713703
  },
  {
    "url": "http://www.imdb.com/",
    "site": "www.imdb.com",
    "id": 6903354771
  }
]

But this doesn't:

SELECT url,site,id 
FROM object_url 
WHERE url IN ( 
    'developers.facebook.com',
    'www.imdb.com/'
)


来源:https://stackoverflow.com/questions/5184523/determine-object-id-of-a-url-to-use-with-the-facebook-open-graph

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!