Advertisement
bcantoni

GoToMeeting Create Meeting

Dec 30th, 2011
2,375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.00 KB | None | 0 0
  1. <?php
  2.  
  3. // sample GoToMeeting API call: create meeting
  4. // docs: https://developer.citrixonline.com/api/gotomeeting-rest-api/apimethod/create-meeting
  5.  
  6. // display all errors
  7. ini_set ('display_errors', 1);
  8. error_reporting (E_ALL);
  9.  
  10. // set valid access_token from OAuth flow
  11. $access_token = '1234...';
  12.  
  13. $url = "https://api.citrixonline.com/G2M/rest/meetings";
  14. $headers = array (
  15.     "Accept: application/json",
  16.     "Content-Type: application/json",
  17.     "Authorization: OAuth oauth_token=$access_token"
  18. );
  19. $data = array (
  20.     'subject' => 'Sample meeting created via API',
  21.     'starttime' => '2013-03-01T08:00:00',
  22.     'endtime' => '2013-03-01T09:00:00',
  23.     'timezonekey' => '',
  24.     'meetingtype' => 'Scheduled',
  25.     'passwordrequired' => 'false',
  26.     'conferencecallinfo' => 'Hybrid' // normal PSTN + VOIP options
  27. );
  28. $data_json = json_encode ($data);
  29.  
  30. $ch = curl_init();
  31. curl_setopt_array ($ch, array (
  32.     CURLOPT_URL => $url,
  33.     CURLOPT_HEADER => false,
  34.     CURLOPT_FOLLOWLOCATION => false,
  35.     CURLOPT_RETURNTRANSFER => true,
  36.     CURLOPT_TIMEOUT => 10,
  37.     CURLOPT_HTTPHEADER => $headers,
  38.     CURLOPT_POST => true,
  39.     CURLOPT_POSTFIELDS => $data_json,
  40. ));
  41.  
  42. $results = curl_exec ($ch);
  43. $info = curl_getinfo ($ch);
  44. curl_close ($ch);
  45.  
  46. print "data sent: $data_json\n";
  47. //print "headers sent: " . print_r($headers,1) . "\n";
  48. //print "curl info: " . print_r($info,1) . "\n";
  49.  
  50. print "data returned: " . print_r($results,1 ) . "\n";
  51. //print "data returned decoded: " . print_r(json_decode($results),1) . "\n";
  52.  
  53. /** sample output:
  54.  
  55. data sent: {"subject":"Sample meeting created via API","starttime":"2013-03-01T08:00:00","endtime":"2013-03-01T09:00:00","timezonekey":"","meetingtype":"Scheduled","passwordrequired":"false","conferencecallinfo":"Hybrid"}
  56. data returned: [{"joinURL":"https:\/\/www3.gotomeeting.com\/join\/569897550","maxParticipants":51,"uniqueMeetingId":200000000016584808,"conferenceCallInfo":"United States: +1 (636) 277-0130\nAccess Code: 569-897-550","meetingid":569897550}]
  57.  
  58. **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement