如何仅使用pageid从图形中获取页面数据

时间:2013-03-06 10:40:02

标签: php facebook facebook-graph-api facebook-page

我有图api的问题。 呼叫“https://graph.facebook.com/[pageID]”失败并显示消息

    {
   "error": {
      "message": "Unsupported get request.",
      "type": "GraphMethodException",
      "code": 100
   }
}

我需要facebook页面的完整网址。有没有办法从pageid获取页面的URL?

编辑:感谢您的提示。错误是,当页面不公开时,我无法通过图表查询信息。它也不起作用,当我(管理页面!)调用graph-url ...

1 个答案:

答案 0 :(得分:4)

如果您查看Page Graph API Reference,可以使用示例网址获取有关该网页的信息,请添加所需网页的网址。示例url请求是:

https://graph.facebook.com/19292868552

结果是:

  {
       "about": "Grow your app with Facebook\nhttps://developers.facebook.com/ ",
       "company_overview": "Facebook Platform enables anyone to build social apps on Facebook, mobile, and the web.\n\n",
       "is_published": true,
       "talking_about_count": 34563,
       "username": "FacebookDevelopers",
       "website": "http://developers.facebook.com",
       "were_here_count": 0,
       "category": "Product/service",
       "id": "19292868552",
       "name": "Facebook Developers",
       "link": "http://www.facebook.com/FacebookDevelopers",
       "likes": 1187896,
       "cover": {
          "cover_id": "10151298218353553",
          "source": "http://sphotos-b.ak.fbcdn.net/hphotos-ak-ash4/s720x720/377655_10151298218353553_500025775_n.png",
          "offset_y": 0,
          "offset_x": 0
       }
    }

我认为在你的问题中你输错了页面ID。