Hey Thamotharakannan,

Unfortunately, this forum is not intended for this style of post, asking 
for 1-on-1 technical support on a specific issue. This forum is meant more 
for high level and general discussion of the platform and services of App 
Engine. 

You should post your code to Stack Overflow <http://stackoverflow.com> 
(where there are many more users who are happy to answer a question in this 
format) along with an explanation of how you are running the code (what 
kind of environment is it deployed to?) and very important to include, what 
the actual error message you saw was.

When you post to Stack Overflow <http://stackoverflow.com>, feel free to 
post here with a link to the question and I'll be happy to take a look. 

Cheers,

Nick
Cloud Platform Community Support
  

On Wednesday, February 8, 2017 at 9:03:18 AM UTC-5, Thamotharakannan 
Ganeshan wrote:
>
> Hi 
> google Calendar event can't insert
> my code
> function create_calendar_event($token , $description, $leaveDate , 
> $toLeaveDate ){
> try{
> $title = 'Leave today';
> $start_time = '00:00'; $end_time = '23:59';
> $timezone = 'Asia/Kolkata';
> $start = array(
> "dateTime" => $leaveDate . "T" . $start_time . ":00",
> "timeZone" => $timezone
> );
> $end = array(
> "dateTime" => $toLeaveDate . "T" . $end_time . ":00",
> "timeZone" => $timezone
> );
> $headerarray = array(
> 'Content-type: application/json',
> 'Authorization: Bearer ' . $token->access_token,
> 'X-JavaScript-User-Agent: Google APIs Explorer'
> );
> $post_data = array(
> "start"       => $start,
> "end"         => $end,
> "summary"     => $title,
> "description" => $description
> );
>  
> $post_data = json_encode($post_data);
> $calendar_id = 'primary';
> $url = 'https://www.googleapis.com/calendar/v3/calendars/' . $calendar_id 
> . '/events';
> $result = $this->curlRequest($url, $headerarray, $post_data);
> return $result;
> }catch(Exception $e){
> // Exception
> }
> }
>  function curlRequest($url,$headerarray,$post_data, $curl_call = true){
> try{
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, $url);
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_HTTPGET, true);
> curl_setopt($ch, CURLOPT_HTTPHEADER, $headerarray);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
> $server_output = curl_exec($ch);
> $info = curl_getinfo($ch);
> $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
> $headers = substr($server_output, 0, $header_size);
> $response = substr($server_output, $header_size);
> $data = array();
> if($info['http_code'] == 200) {
> $data['headers'] = $headers;
> $data['response'] = json_decode($response);
> $data['status'] = 'SUCCESS';
> } else {
> if($info['http_code'] == 404) {
> $data['response'] = 'Not Found';
> $data['status'] = 'ERROR';
> } else {
> $data['response'] = json_decode($response);
> $data['status'] = 'ERROR';
> }
> $data['headers'] = $headers;
> }
> curl_close($ch);
> return $data;
> } catch (Exception $e) {
> // Exception
> }
> }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/d1ccefe3-b250-4410-bf7e-0fd2371c217f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine] g... Thamotharakannan Ganeshan
    • [google-appengi... 'Nick (Cloud Platform Support)' via Google App Engine

Reply via email to