Zend Gdata日历错误的请求错误 [英] Zend Gdata Calendar Bad Request Error

查看:108
本文介绍了Zend Gdata日历错误的请求错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用CakePHP中的ZEND GData API,并对其进行设置并获取日历列表。

I've been trying to work wit the ZEND GData API in CakePHP and have it setup and retreiving a list of calendars.

所有这些都有效,但是当我尝试检索日历事件时,出现了严重的请求错误,并且不确定如何解决。这是代码,后面是运行脚本时收到的错误消息。

All of that works, however when I try to retrieve calendar events, I get a bad request error and I am not sure how to solve it. Here is the code followed by the error message received when the script is run.

* 注意:我正在使用XAMPP在我的机器上进行测试

        //GET LIST OF EVENTS
        $index = 0;
        foreach($listFeed as $list) {
            $query = $service->newEventQuery($list->link[0]->href);
            // Set different query parameters
            $query->setUser('default');
            $query->setVisibility('private');
            $query->setProjection('full');
            $query->setOrderby('starttime');

            // Get the event list
            try {
                $eventFeed[$index] = $service->getCalendarEventFeed($query);
            } catch (Zend_Gdata_App_Exception $e) {
                echo "Error: " . $e->getResponse() . "<br />";
            }
            $index++;
        }

这是错误消息:


错误:HTTP / 1.1 400错误的请求内容类型:text / html; charset = UTF-8日期:2012年5月14日星期一格林尼治标准时间到期:2012年5月14日星期一04:04:41 GMT缓存控制:私有,最大年龄= 0 X-content-type-options: nosniff X-frame-options:SAMEORIGIN X-xss保护:1; mode = block服务器:GSE连接:关闭无效的请求URI

Error: HTTP/1.1 400 Bad Request Content-type: text/html; charset=UTF-8 Date: Mon, 14 May 2012 04:04:41 GMT Expires: Mon, 14 May 2012 04:04:41 GMT Cache-control: private, max-age=0 X-content-type-options: nosniff X-frame-options: SAMEORIGIN X-xss-protection: 1; mode=block Server: GSE Connection: close Invalid request URI

感谢您的时间和帮助。

推荐答案


  1. $ service-> newEventQuery()不会这里不需要参数。

  1. $service->newEventQuery() doesn't need a parameter here.

我相信您正在从一个用户那里检索日历列表。假设是你自己。因此

I believe you're retrieving calendar lists from a single user. Let's say it's yourself. So

$ query-> setUser('default');

不会帮助您获取第二个日历,而只会获取主日历,即您的电子邮件地址。

won't help you get any second calendar, instead only the primary calendar which name is your email address.

Google开发人员协议指南

要获取供稿,请使用在本文档上一部分中找到的URL将以下HTTP请求发送到Calendar:

To get a feed, you send the following HTTP request to Calendar, using the URL you found in the previous section of this document:

获取https://www.google.com/calendar/feeds/userID/private-magicCookie/full

因此将userID替换为您的calendarID以获取特定日历的事件供稿。

So replace userID with your calendarID to get a particular calendar's event feeds.

尝试

    $index = 0;
    foreach($listFeed as $list) {
        $calendarID = $list->id->text;
        $user = str_replace("http://www.google.com/calendar/feeds/default/owncalendars/full/", '', $calendarID);
        $query = $service->newEventQuery();
        // Set different query parameters
        $query->setUser($user);
        $query->setVisibility('private');
        $query->setProjection('full');
        $query->setOrderby('starttime');

        // Get the event list
        try {
            $eventFeed[$index] = $service->getCalendarEventFeed($query);
        } catch (Zend_Gdata_App_Exception $e) {
            echo "Error: " . $e->getResponse() . "<br />";
        }
        $index++;
    }

这篇关于Zend Gdata日历错误的请求错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆