【问题标题】:Read posts from g+ fanpage using php (curl)使用 php (curl) 从 g+ fanpage 阅读帖子
【发布时间】:2014-03-19 16:35:10
【问题描述】:

我正在尝试使用 php 阅读来自 g+ 粉丝页面的最新帖子。唉,文档对如何做到这一点没有太大帮助:/

到目前为止,我已经尝试了以下方法:

<?php
$curlSession = curl_init();
curl_setopt($curlSession, CURLOPT_URL, 'https://www.googleapis.com/plus/v1/people/{userID}/activities/public?key={apikey}');
curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true);
curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
$jsonData = json_decode(curl_exec($curlSession));
curl_close($curlSession);

{apikey}{userID} 当然是占位符。我通过开发者控制台生成了 api 密钥,无论是服务器密钥还是浏览器密钥都不会对下面的结果产生任何影响。 Google+ API 已激活。

这是结果:

{
   "error":{
      "errors":[
         {
            "domain":"usageLimits",
            "reason":"accessNotConfigured",
            "message":"Access Not Configured. Please use Google Developers Console to activate the API for your project."
         }
      ],
      "code":403,
      "message":"Access Not Configured. Please use Google Developers Console to activate the API for your project."
   }
}

您对问题所在有什么建议吗?我错过了什么吗? 我必须为此类 api 请求提供帐单信息吗?

【问题讨论】:

  • 当您说“粉丝专页”时,您是指 Google+ 社区还是 Google+ 信息页? (在这种情况下,区别很重要。)
  • 我说的是官方 Google+ 信息页。

标签: php rest curl google-api google-plus


【解决方案1】:

它会在错误消息中告诉你哪里错了...Please use Google Developers Console to activate the API for your project.

转到此处https://code.google.com/apis/console/,在左侧单击 APIs & Auth,然后打开 Google+ API 以及您需要的任何其他 API

【讨论】:

  • 您好,cmorrissey,:) 感谢您的回答!此项目的 Google+ Api 已激活:/ 我只想从上述 URL 获取信息,是否需要激活任何其他 API?干杯:)
猜你喜欢
  • 2014-05-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-08-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多