2014-03-19 30 views
1

我正在尝试使用php阅读g + fanpage的最新帖子。可惜的是,文件是不是就如何做到这一点的是有帮助的:/使用PHP(卷曲)从g + fanpage阅读帖子

到目前为止,我已经试过如下:

<?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请求提供帐单信息?

+1

当你说“粉丝专页”时,你是指Google+社群还是Google+信息页? (在这种情况下,区别很重要。) – Prisoner

+0

我正在讨论Google+官方页面。 – tillsanders

回答

2

它会告诉你正确的错误消息什么是错... Please use Google Developers Console to activate the API for your project.

去这里https://code.google.com/apis/console/,对API的左侧点击&验证,然后启用Google+ API和你需要什么都其他API

+1

你好,cmorrissey,:)感谢您的回答!该项目的Google+ Api已经激活:/我只想从上面的URL中获取信息,是否需要激活任何其他API?干杯:) – tillsanders