在谷歌日历上同步约会时收到警告?

时间:2012-12-13 08:31:43

标签: php api google-api google-calendar-api open-basedir

在尝试通过我的在线服务器在我的Google日历上同步约会时,我收到了警告

以下是代码行

public function addEvent($params) {
        $url = "http://www.google.com/calendar/feeds/{$this->getFeedEmail()}/private/full";

        $xml = "<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'>{$params['title']}</title> 
              <content type='text'>{$params['content']}</content>
              <gd:when startTime='{$params["startTime"]}' endTime='{$params["endTime"]}'>
              </gd:when>
              <gd:transparency value='http://schemas.google.com/g/2005#event.transparent'>  
              </gd:transparency>  
              <gd:eventstatus value='http://schemas.google.com/g/2005#event.confirmed'>  
              </gd:eventstatus>  
              <gd:where valuestring='{$params['where']}'></gd:where> 

            </entry>
                ";
        $ret = $this->calPostRequest($url, $xml);
        $matches = array();
        if(preg_match('/gsessionid=(.*?)\s+/', $ret, $matches)) {
            $url .= "?gsessionid={$matches[1]}";
            $ret = $this->calPostRequest($url, $xml);
        }
        $retFields = explode("\n", $ret);

        //ERROR HERE LINE 66
        $entryXML = simplexml_load_string($retFields[count($retFields)-1]); //ERROR HERE

        return array(
                "id"=> (string)$entryXML->id,
                "etag"=> $this->getETagFromHeader($retFields),
                "link"=> $this->getEditLinkFromHeader($retFields)
                );
    }

以下是警告:

Warning: curl_setopt_array() [function.curl-setopt-array]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /home/xxxxxx/public_html/wp-content/plugins/xxxxxxxxx-premium/menu-pages/google-cal-api/GoogleCalendar.php on line 115
HTTP/1.1 201 Created Expires: Thu, 13 Dec 2012 08:00:49 GMT Date: Thu, 13 Dec 2012 08:00:49 GMT Set-Cookie: S=calendar=8Uizq1g9cPoo2XdIOGqjoQ;Expires=Fri, 21-Dec-2012 13:29:48 GMT Content-Type: application/atom+xml; charset=UTF-8; type=entry Cache-Control: private, max-age=0, must-revalidate, no-transform Vary: Accept, X-GData-Authorization, GData-Version GData-Version: 2.6 ETag: “EU0MTwxFdyp7JGA6WhJa” Location: http://www.google.com/calendar/feeds/andybartonpga%40gmail.com/private/full/03lq0bj7a93ck79e6meeq6263c Content-Location: http://www.google.com/calendar/feeds/andybartonpga%40gmail.com/private/full/03lq0bj7a93ck79e6meeq6263c X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Server: GSE Transfer-Encoding: chunked http://www.google.com/calendar/feeds/andybartonpga%40gmail.com/events/03lq0bj7a93ck79e6meeq6263c2012-12-13T08:00:48.000Z2012-12-13T08:00:49.000Z2012-12-13T08:00:49.000Zandy bartonandybartonpga@gmail.com

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Start tag expected, ‘<' not found in /home/xxx/public_html/wp-content/plugins/xxxxxxxxxxxxxxxxxx/menu-pages/google-cal-api/GoogleCalendar.php on line 66

Warning: simplexml_load_string() [function.simplexml-load-string]: 1 in /home/xxxx/public_html/wp-content/plugins/xxxxxxx-premium/menu-pages/google-cal-api/GoogleCalendar.php on line 66

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/xxxxxxx/public_html/wp-content/plugins/xxxxxxxx-premium/menu-pages/google-cal-api/GoogleCalendar.php on line 66

快照: enter image description here

php.ini safe_mode = off中的服务器但是open_basedir == xxx/xxx/xxx/xxx/xx

服务器不允许我更改: open_basedir == ""

我找到了一种解决方法但无法理解,我在哪里提出了解决方法代码

Link1:here

Link2:here

伙伴们帮助了我。 感谢

1 个答案:

答案 0 :(得分:0)

您是否在Link2中尝试过该解决方案?如果您没有权限修改php.ini,它看起来可能会有用。