2013-04-01 336 views
7

我嘗試使用php中的google api class從谷歌分析中獲取數據。 我檢查了僕人谷歌組,發現大多數情況下,當Curl關閉和SSL關閉時出現錯誤,但我檢查了phpinfo()和booth正在運行。任何人都知道它可能是什麼?在我的本地服務器上運行,但在網絡服務器上它沒有運行。Google API登錄

<br /> 
<b>Fatal error</b>: Uncaught exception 'Exception' with message 'GAPI: Failed to authenticate user. Error: &quot;Error=BadAuthentication 
Url=https://www.google.com/accounts/ServiceLogin?service=analytics#Email=mail 
Info=WebLoginRequired 
&quot;' in /home/express/public_html/loggedIn/gapi.class.php:418 
Stack trace: 
#0 /home/express/public_html/loggedIn/gapi.class.php(62): gapi-&gt;authenticateUser('mail', 'pw') 
#1 /home/express/public_html/loggedIn/request.php(10): gapi-&gt;__construct('mail', 'pw') 
#2 {main} 
    thrown in <b 
>/home/express/public_html/loggedIn/gapi.class.php</b> on line <b>418</b><br /> 

enter image description here

+1

獲取數據你應該嘗試的官方客戶端庫,而不是之前批准您的帳戶。 https://code.google.com/p/google-api-php-client/ – Eduardo

回答

24

所以瀏覽更多的組後,朋友發現,你需要在開始首次at this url

+1

你的解決方案已經幫了我很多...感謝哥們 –

+0

就是這樣,謝謝!我注意到有些帳戶需要這樣做,有些則不需要。 – Aurelien

+1

我不得不做的另一件事是,通過[這裏](https://www.google.com/settings/security/lesssecureapps)來訪問不太安全的應用程序。只有在您的兩步驗證過程未啓用的情況下。我認爲在這種情況下,您可以嘗試創建特定於應用程序的密碼並使用它。 –