2014-03-19 31 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