Get events from Oficce 365 RRS feed

  • Question

  • Hi,

    how can i get events from Office 365 Calendar, from REST? I create application in Azure, i have Token from this request:
    client_id=[app_id from AZURE]

    Next i try get Events:

      $ch = curl_init();
      $headers = array();
      $headers[] = 'Content-Type: application/x-www-form-urlencoded';
      $postFields = 'grant_type=authorization_code&code='.$authCode.'&redirect_uri='.$redirectUri.'&scope=openid&client_id='.$clientId.'&client_secret='.$clientSecret;
      curl_setopt($ch, CURLOPT_URL,'');
      curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      $serverOutput = curl_exec ($ch);
      curl_close ($ch);
      $jsonOutput = json_decode($serverOutput, true);
      $chUser = curl_init();
      $headersUser[] = 'Authorization: Bearer '.$jsonOutput['id_token'];
      curl_setopt($chUser, CURLOPT_URL,'');
      curl_setopt($chUser, CURLOPT_CUSTOMREQUEST, 'GET');
      curl_setopt($chUser, CURLOPT_HTTPHEADER, $headersUser);
      $serverOutputUser = curl_exec($chUser);
    But i have error "Access token validation failure". What i do wrong? I found in internet, but i see examples from Laravel, i need simple, universal code, I need use this in Wordpress to write events from calendar for page users.
    I am grateful for your help.

    Tuesday, February 27, 2018 7:33 PM

All replies