使用Zend_Gdata_Calendar()在Google日历上获取"禁止错误403"

H. *_*nce 2 zend-framework google-calendar-api

我在我的某个网站的主页上运行了一个嵌入式脚本,该脚本会在我们的Google日历上提取所选事件列表并在页面上列出.自2011年左右以来,我一直在运行这个脚本,没有更改或修改.

昨天(也许是前一天)脚本开始抛出错误Forbidden Error 403.

这是脚本的片段:

$ctz = 'America/Los_Angeles';
$calendarID[] = 'example.com_abcdefghijklmnop1234567890@group.calendar.google.com'; //Dept 1 Events
$calendarID[] = 'example.com_klmnopqrstuvwxyz0987654321@group.calendar.google.com'; //Dept 2 Events
/*...*/
$eventArray = buildEventList($calendarID, $ctz);


function buildEventList($calendarID=NULL,$ctz=NULL) {

    require_once('Zend/Loader.php');
    Zend_Loader::loadClass('Zend_Gdata');
    Zend_Loader::loadClass('Zend_Gdata_Calendar');
    Zend_Loader::loadClass('Zend_Uri_Http');

    $gdataCal = new Zend_Gdata_Calendar();
    $query = $gdataCal->newEventQuery();

    try {
        /*...*/
    }

    catch (Zend_Gdata_App_Exception $e) {
        $return = $e->getMessage();
    }

    return $return;

}
Run Code Online (Sandbox Code Playgroud)

catch {}导致显示以下错误消息:

Expected response code 200, got 403
<HTML>
<HEAD>
<TITLE>Forbidden</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Forbidden</H1>
<H2>Error 403</H2>
</BODY>
</HTML>
Run Code Online (Sandbox Code Playgroud)

关于为什么开始发生或如何解决的任何想法?

注意:我登录了我的每个Google日历,其设置上没有任何内容发生变化.它们仍然是公开共享的,并且ID没有更改 - 我验证了Google帐户中的所有内容.

通过不断的研究来学习:​​我认为我可能需要Google开发人员密钥 - (1)不确定如何获得一个和(2)继续研究.

Ald*_*wen 5

自11月17日起,您无法再使用Google API V1或API V2.Zend Gdata使用谷歌API V2.所以,你不能再使用zend来获取事件了.您必须使用谷歌库或使用自己的类.您可以看到没有谷歌库的谷歌api V3类的示例:Authentification Zend Gdata(403禁止)