codeigniter内部的Google REST调用失败


Google REST call fails inside codeigniter

我有一个对谷歌日历的REST调用,在我的旧网站(www.gmbc.org/events.php)上运行良好,但当从代码点火器控制器发出相同的调用时,timeMin/timeMax选项会导致它向我抛出400(删除它们,调用成功检索到2012年的整个日历):

    $st_date = date(DateTime::ATOM);
    $end_date = date(DateTime::ATOM, time()+(31 * 24 * 60 * 60));
    $call_url = 'https://www.googleapis.com/calendar/v3/calendars/calendar%40gmbc.org/events?timeMin='.$st_date.'&timeMax='.$end_date.'&singleEvents=true&orderBy=startTime&key=[mykeythatworksjustfine]';
    $events_call = $this->curl_get($call_url);

回显$call_url确认它是以相同的方式创建的,而print_r-ing结果则确认它已到达google:

stdClass Object (
[error] => stdClass Object (
  [errors] => Array (
    [0] => stdClass Object (
      [domain] => global [reason] => badRequest [message] => Bad Request )
    )
    [code] => 400 [message] => Bad Request
  )
)

可能发生了什么?codeigniter会干扰curl调用吗?

我能够使用API资源管理器成功地从设置了TimeMin和TimeMax的日历中检索事件:https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.events.list?calendarId=calendar%2540gmbc.org&timeMax=2014-11-30T00%253A00%253A00Z&timeMin=2014-10-01T00%253A00%253A00Z&amp_h=2&

它发送的查询是:得到https://www.googleapis.com/calendar/v3/calendars/calendar%40gmbc.org/events?timeMax=2014-11-30T00%3A00%300Z&timeMin=2014-10-01T00%3A00%3A00Z&密钥={YOUR_API_key}

试着确保从PHP发送的查询的结果相同。