如何获得 googleplus 页面关注者的数量?

How to get number of googleplus page followers?

是否真的有可能获得我的 googleplus 页面的关注者数量。以下脚本 - 我在较早的 post 中找到 - 不起作用(无输出):

$google_api_key = 'XYZXYZXYZXYZXYZXYZ';
$page_id = 'MYNUMERICPAGEID';
$data = @file_get_contents("https://www.googleapis.com/plus/v1/people/$page_id?key=$google_api_key");
$data = json_decode($data, true);
echo $data['plusOneCount'];

谢谢!

可能有一些错误:

  • Developer Console 上没有更新的项目。
  • 没有为该项目启用 API。
  • 过去thresholds/quotas.

尝试以下操作:

  1. 登录您的 Google Developers Console
  2. 您需要一个项目。
    • 如果您没有项目,请创建一个。
  3. 对该项目启用 "Google Plus API"。
  4. 确认 usage/quotes 在容差范围内并且您没有超过。

从那里开始,您的通话应该可以正常工作:

GET https://www.googleapis.com/plus/v1/people/{USER_ID}?key={YOUR_API_KEY}

在我的例子中,我正在查询 Google's 的页面,所以 {USER_ID} = 116899029375914044550。然后我可以看到 plusOneCount:

{
 "kind": "plus#person",
 "etag": "\"RqKWnRU4WW46-6W3rWhLR9iFZQM/bTf-sq_Sg3fLAFijixPfjtKM5f8\"",
 "urls": [
  {
   "value": "http://www.google.com",
   "type": "website",
   "label": "www.google.com"
  },
  {
   "value": "http://www.google.com/support/",
   "type": "other",
   "label": "Google Help"
  },
  {
   "value": "http://googleblog.blogspot.com/",
   "type": "other",
   "label": "Official Blog"
  },
  {
   "value": "http://twitter.com/#!/google",
   "type": "other",
   "label": "@google"
  },
  {
   "value": "http://www.google.com/about/corporate/company/",
   "type": "other",
   "label": "Company Info"
  },
  {
   "value": "http://www.google.com/press/",
   "type": "other",
   "label": "News"
  },
  {
   "value": "http://www.google.com/press/google-directory.html",
   "type": "other",
   "label": "More Google pages"
  }
 ],
 "objectType": "page",
 "id": "116899029375914044550",
 "displayName": "Google",
 "tagline": "News and updates on Google's products, technology and more",
 "aboutMe": "<p>Welcome to Google&#39;s official page. Here, you&#39;ll find product news and announcements, company updates, glimpses into what it&#39;s like to work at Google, discussions on technology and the web, and much more. </p><p><span>Given the volume of feedback we receive here, we may not be able to respond individually to every comment and we&#39;re not able to provide product support (if you&#39;re having product issues, please visit our Help Center). Rest assured we&#39;re paying attention, and we&#39;re always eager to hear from you.</span></p>",
 "url": "https://plus.google.com/+google",
 "image": {
  "url": "https://lh4.googleusercontent.com/-v0soe-ievYE/AAAAAAAAAAI/AAAAAAAC9wQ/JD8tdz3bFTM/photo.jpg?sz=50",
  "isDefault": false
 },
 "isPlusUser": true,
 "plusOneCount": 10757884,
 "circledByCount": 7692912,
 "verified": true,
 "cover": {
  "layout": "banner",
  "coverPhoto": {
   "url": "https://lh4.googleusercontent.com/-PLPoXvnN0XI/UTdr4xTtuHI/AAAAAAAA_1U/p1n_Za3BZUg/s630-fcrop64=1,00000000fe06fe97/g_plus_background.png",
   "height": 528,
   "width": 940
  },
  "coverInfo": {
   "topImageOffset": 0,
   "leftImageOffset": 0
  }
 }
}