Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用php rest作用域在outlook日历上编写事件?_Php_Jquery_Outlook_Oauth 2.0_Fullcalendar - Fatal编程技术网

如何使用php rest作用域在outlook日历上编写事件?

如何使用php rest作用域在outlook日历上编写事件?,php,jquery,outlook,oauth-2.0,fullcalendar,Php,Jquery,Outlook,Oauth 2.0,Fullcalendar,我可以使用oauth live connect阅读所有hotmail日历事件和联系人 下面是登录url $urls = https://login.live.com/oauth20_authorize.srf?client_id='.$auth['client_id'].'&scope=wl.signin%20wl.basic%20wl.emails%20wl.contacts_emails%20wl.contacts_calendars%20wl.calendars_update&am

我可以使用oauth live connect阅读所有hotmail日历事件和联系人

下面是登录url

$urls = https://login.live.com/oauth20_authorize.srf?client_id='.$auth['client_id'].'&scope=wl.signin%20wl.basic%20wl.emails%20wl.contacts_emails%20wl.contacts_calendars%20wl.calendars_update&response_type=code&redirect_uri='.$app_path;
成功登录后,我可以使用accesstoken获取所有hotmail日历事件和联系人

url = 'https://apis.live.net/v5.0/me/contacts?access_token='.$accesstoken;
url = 'https://apis.live.net/v5.0/me/events?access_token='.$accesstoken;    
response =  file_get_contents($url);
$response = json_decode($response, true);   
事件在jquery fullcalendar中列出。 此外,我还可以在jquery fullcalendar中添加带有主题、开始日期、结束日期和描述等字段的事件

以下链接仅供我参考

创建事件函数 但未在live server中创建事件

请帮帮我。

是的,我得到了答案。 使用cURL方法将事件发布到outlook server

$url = "https://apis.live.net/v5.0/me/events";                   
                $data_json = '{
                    "name": "'.$subject.'",
                    "description": "'.$description.'",
                    "start_time": "'.$new_start_date_time.':00+530",
                    "end_time": "'.$new_end_date_time.':00+530",
                    "location": "'.$location.'",
                    "is_all_day_event": true,
                    "availability": "busy",
                    "visibility": "public"
                }';
             //print_r($data_json);die;
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json); 
            curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            "Content-Type: application/json",
            "Authorization: Bearer " . $accesstoken, 
            "Content-length: ".strlen($data_json))
            );
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             $result = curl_exec($ch);  
 $url = "https://apis.live.net/v5.0/me/events";
                $fuseau = date("P"); 
                $titre = "Hello"; 
                $description = "Welcome to our world";
                $data_json = '{   "Subject": "' . $titre . '",
                                  "start_time": "2015-12-22T01:30:00-11:00",
                                  "end_time": "2015-12-22T03:00:00-11:00",
                                  "location": "Coho Vineyard and Winery, 123 Main St., Redmond WA 19532",
                                  "is_all_day_event": false,
                                  "availability": "busy",
                                  "visibility": "public"                    
                                }';

                $options = array("http" => array(   "method" => "POST",
                                                    "header" => "Authorization: Bearer $accesstoken \r\n" .
                                                                "Content-type: application/json\r\n",
                                                    "content" => $data_json                                         
                                                    ));



                $context = stream_context_create($options);  
$url = "https://apis.live.net/v5.0/me/events";                   
                $data_json = '{
                    "name": "'.$subject.'",
                    "description": "'.$description.'",
                    "start_time": "'.$new_start_date_time.':00+530",
                    "end_time": "'.$new_end_date_time.':00+530",
                    "location": "'.$location.'",
                    "is_all_day_event": true,
                    "availability": "busy",
                    "visibility": "public"
                }';
             //print_r($data_json);die;
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json); 
            curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            "Content-Type: application/json",
            "Authorization: Bearer " . $accesstoken, 
            "Content-length: ".strlen($data_json))
            );
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             $result = curl_exec($ch);