codeigniter内的Google REST调用失败

时间:2014-11-02 22:34:36

标签: php codeigniter rest curl google-calendar-api

我的Google日历上有一个REST调用,在我的旧网站(www.gmbc.org/events.php)上运行正常,但是当从一个codeigniter控制器发出相同的调用时,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会干扰卷曲调用吗?

1 个答案:

答案 0 :(得分:0)