Php GAPI:请求帐户数据失败

Php GAPI:请求帐户数据失败,php,google-analytics,google-analytics-api,Php,Google Analytics,Google Analytics Api,是的,GAPI已经很久没有更新了,是的,谷歌提供了第一方PHP库和教程。这两者都是一团糟,而且对于小规模的脚本来说都是言过其实了 但您可以通过以下线程立即修复GAPI: 特别是,您需要修补GAPI类的头部,替换为以下内容 Exception: GAPI: Failed to request account data. Error: " Error 404 (Not Found)!!1 * { margin: 0; padding: 0; } html,

是的,GAPI已经很久没有更新了,是的,谷歌提供了第一方PHP库和教程。这两者都是一团糟,而且对于小规模的脚本来说都是言过其实了

但您可以通过以下线程立即修复GAPI:

特别是,您需要修补GAPI类的头部,替换为以下内容

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. "

从那时起,它就如预期的那样工作。

是的,GAPI已经很长时间没有更新了,是的,谷歌提供了第一方PHP库和教程。这两者都是一团糟,而且对于小规模的脚本来说都是言过其实了

但您可以通过以下线程立即修复GAPI:

特别是,您需要修补GAPI类的头部,替换为以下内容

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. "

从那以后,它就如预期的那样工作了。

这是对帕兰蒂尔答案的一种暗示

除了修补头部,还需要修改以下行以消除“未定义变量”错误:

应该是:

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

这是对帕兰蒂尔回答的一种暗示

除了修补头部,还需要修改以下行以消除“未定义变量”错误:

应该是:

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

这是个问题吗?该端点不再存在。查找更新的GA库。它是1.3版。请查看该链接:该库自2009年以来从未更新过。自那时以来,GA的数据导出/报告API已经进行了2次迭代。我相信Google为PHP提供了第一方GA API客户端库。这是个问题吗?该端点不再存在。查找更新的GA库。它是1.3版。请查看该链接:该库自2009年以来从未更新过。自那时以来,GA的数据导出/报告API已经进行了2次迭代。我相信谷歌为PHP提供了第一方GA API客户端库。+1还包括答案中的头部补丁信息,而不仅仅是一个链接。+1还包括答案中的头部补丁信息,而不仅仅是一个链接。