2013-05-03 21 views
1
Exception: GAPI: Failed to request account data. Error: 

" Error 404 (Not Found)!!1 *   
{ 
    margin: 0; 
    padding: 0; 
} 
html, 
code { font: 15px/22px arial,sans-serif } 
html { 
    background: #fff; 
    color: #222; 
    padding: 15px; 
} 
body { 
    margin: 7% auto 0; 
    max-width: 390px; 
    min-height: 180px; 
    padding: 30px 0 15px; 
} 
* > body { 
    background: url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat; 
    padding-right: 205px; 
} 
p { 
    margin: 11px 0 22px; 
    overflow: hidden; 
} 
ins { 
    color: #777; 
    text-decoration: none; 
} 
a img { border: 0 } 
@media screen and (max-width:772px) { 
    body { 
     background: none; 
     margin-top: 0; 
     max-width: none; 
     padding-right: 0; 
    } 
} 


404. That's an error. The requested URL 
     /analytics/feeds/accounts/default?start-index=1&max-results=20 
was not found on this server. That's all we know. " 
+0

那是一个问题吗?该端点不再存在。找到更新的GA库。 – vly 2013-05-03 09:20:12

+0

它是版本1.3请参阅该链接:https://code.google.com/p/gapi-google-analytics-php-interface/ – tushAR 2013-05-03 10:05:49

+1

自2009年以来,该库尚未更新。已有2次GA数据迭代导出/报告API。我相信Google为PHP提供了第一方GA API客户端库。 – vly 2013-05-03 22:54:58

回答

5

是的,GAPI尚未更新很长时间,是的,Google确实提供了第一方PHP库和教程。哪一个都是一团糟,而且对于小规模的脚本来说是过分夸张的。

但是你可以在任何时候通过这个线程下修GAPI:https://code.google.com/p/gapi-google-analytics-php-interface/issues/detail?id=84

特别是,你需要修补的GAPI类的头,用下面的替换。

const client_login_url = 'https://www.google.com/accounts/ClientLogin'; 
const account_data_url = 'https://www.googleapis.com/analytics/v2.4/management/accounts/~all/webproperties/~all/profiles'; //https://www.google.com/analytics/feeds/accounts/default 
const report_data_url = 'https://www.googleapis.com/analytics/v2.4/data'; 

从那里它工作正常。

+0

+1还包括答案中的头部补丁信息,而不仅仅是一个链接。 – Finglish 2013-10-12 08:56:47

1

这是Palantir的答案的一个假设。

除了修补头部以下行需要进行修改,以摆脱一个“未定义变量”错误:

$account_root_parameters['startDate'] = strval($google_results->startDate); 
$account_root_parameters['endDate'] = strval($google_results->endDate); 

应该是:

相关问题