使用PHP cURL在Google日历中创建活动时出现问题
我正在尝试使用cURL函数添加一个带有PHP脚本的事件。它没有返回任何内容,并且事件没有添加到我的日历中。有人可以帮我吗?
这让我在最近几天难过,任何帮助都会非常感激。
这是代码:
我已经验证了xml,$ title和$ eventInfo是否正确,以及
//combine the last name, first name, and email address into one variable to set as title for the event
$this->httpHeaderSettings = array('Content-Type: text/xml', "Authorization: AuthSub token="" . $sessionToken . """)
$title = $eventInfo['lname'] . ", " . $eventInfo['fname'] . ", " . $eventInfo['email'];
//create an ATOM feed to send off to Google services with the event data
$xmlData = "<entry xmlns='http://www.w3.org/2005/Atom'" .
"xmlns:gd='http://schemas.google.com/g/2005'>" .
"<category scheme='http://schemas.google.com/g/2005#kind'" .
"term='http://schemas.google.com/g/2005#event'></category>" .
"<title type='text'>" . $title . "</title>" . <br />
"<content type='text'>" . $eventInfo['desc'] . "</content>" .
"<gd:transparency" .
"value='http://schemas.google.com/g/2005#event.opaque'>" .
"</gd:transparency>" .
"<gd:eventStatus" .
"value='http://schemas.google.com/g/2005#event.confirmed'>" .
"</gd:eventStatus>" .
"<gd:where valueString='blank'></gd:where>" .
"<gd:when startTime='" . $eventInfo['start'] . "'" .
"endTime='" . $eventInfo['end'] . "'></gd:when>" .
"</entry>";
curl_setopt($this->curlResource, CURLOPT_URL, "https://www.google.com/calendar/feeds/default/private/full");
curl_setopt($this->curlResource, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($this->curlResource, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($this->curlResource, CURLOPT_POST, 1);
curl_setopt($this->curlResource, CURLOPT_HEADER, 1);
$this->httpHeaderSettings[] = 'Content-Type: text/atom+xml';
curl_setopt($this->curlResource, CURLOPT_HTTPHEADER, $this->httpHeaderSettings);
curl_setopt($this->curlResource, CURLOPT_POSTFIELDS, $xmlData);
curl_setopt($this->curlResource, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($this->curlResource);
return $response;
没有找到相关结果
已邀请:
1 个回复
傻零凰死授