FQL query to fetch all data of a facebook page

2019-09-01 01:01发布

问题:

I want to fetch all the accessible data of a facebook page (Only page table data is enough for me now). I only have the page url of that page. After observing some urls i found that the url's can be in the following 2 formats.

  • http://www.facebook.com/username
  • http://www.facebook.com/pages/name/page_id

Now what i am doing is querying in facebook page table by username(for 1st type of url's) or page_id(for 2nd one's).

Here are the questions..

  • Am i doing anything wrong?
  • Anyone have any better sugestion? actually i am searching for a generation solution of this problem.
  • I also want to get the page visits count. Can you please give me some idea of how can i find the visits count?

Thank you very much for your time.

回答1:

For the columns to query from page see: http://developers.facebook.com/docs/reference/fql/page/

the FQL will look like for by ID:

SELECT {columns} FROM page WHERE page_id=PAGEID

and for by page name:

SELECT {columns} FROM page WHERE username='PAGEUSERNAME'

Happy coding!