From 2fd94e15f6b196e90a8a9454ebcd1fbffb2cdb3a Mon Sep 17 00:00:00 2001 From: stephen lee Date: Thu, 4 Feb 2021 11:43:38 +0800 Subject: [PATCH] Added POST support in make call; Added Create meeting; Added get User info --- src/Zoom.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Zoom.php b/src/Zoom.php index b51e864..959c219 100644 --- a/src/Zoom.php +++ b/src/Zoom.php @@ -53,6 +53,16 @@ public function getLoginUrl($state = '') throw new ZoomException("Error: getLoginUrl()"); } + + public function createUserMeeting($id, $topic = 'New Meeting', $type = '1', $password = 'MTGPASS', $agenda = 'Start Meeting') + { + return $this->_makeCall('users/' . $id . '/meetings', compact('topic', 'type', 'password','agenda'), 'POST'); + } + + public function getUserInfo($id) + { + return $this->_makeCall('users/' . $id); + } public function getUserMeetings($id, $type = 'live', $page_size = 30, $page_number = 1) { @@ -122,6 +132,15 @@ protected function _makeCall($function, $params = null, $method = 'GET') curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HEADER, true); + + if ($method === 'POST') { + array_push($headerData, 'Content-Type:application/json'); + $data_string = json_encode($params); + + curl_setopt($ch, CURLOPT_POST, count($params)); + curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headerData); + } $jsonData = curl_exec($ch);