'.print_r($users,1).'';
echo '
ZOOM создание мероприятий
';
echo '
Пользователь |
'.$users[0]['first_name'].' '.$users[0]['last_name'].' |
';
$des = 'view';
if(isset($_GET['des'])) $des = $_GET['des'];
if(isset($_POST['meetingcreate'])){
//Создание мероприятия
$start_time = strtotime($_POST['start_time'])-(60*60*3);//на сервере время +3
$param = array(
'topic'=>$_POST['topic'],
'type'=>2,
'start_time'=>date('Y',$start_time).'-'.date('m',$start_time).'-'.date('d',$start_time).'T'.date('H',$start_time).':'.date('i',$start_time).':00Z',
'duration'=>$_POST['duration'],
'timezone'=>"Europe/Moscow",
'password'=>$_POST['password']
);
$meeting = zoom_meetingCreate($users[0],$param);
//echo ''.print_r($meeting,1).'
';
$des='view';
}
if($des=='meetingcreate'){
echo 'Создание мероприятия
';
echo '';
}
if($des=='view'){
$meetings = zoom_meetingList($users[0]);
//echo ''.print_r($meetings,1).'
';
echo 'Запланированные мероприятия
';
echo '
Время |
Название |
ID |
Пароль |
Ссылка для управления |
Ссылка для подключения |
Создать |
';
foreach($meetings['meetings'] as $key => $val){
$start_time = strtotime($val['start_time']);
$meet = getMeeting($val['uuid']);
echo '
'.date('H:i d.m.Y',$start_time).' |
'.$val['topic'].' |
'.$meet['id'].' |
'.$meet['password'].' |
Перейти |
'.$val['join_url'].' |
длит: '.$val['duration'].'мин. |
';
}
echo '
';
}
function getMeeting($uuid){
$file = 'zoom/'.$uuid.'.json';
if(file_exists($file)){
return json_decode(file_get_contents($file) ,1);
}else{
return array();
}
}
function zoom_meetingList($user){//Просмотр мероприятий
$out = array();
$out['err']=1;
$url = 'users/'.$user['id'].'/meetings';
$rez = zoom_curl($url);
$rez['response']["page_size"] = 100;
/*
Array
(
[err] => 0
[msg] => cURL Ok
[response] => {
"page_size":30,
"total_records":2,
"next_page_token":"",
"meetings":[
{
"uuid":"+G+izsejS26d7QmpzpbWqA==",
"id":76902907580,
"host_id":"MgQ_chc0Sx2aGLK2eq-_-w",
"topic":"первое мероприятие 1",
"type":2,
"start_time":"2020-09-30T13:30:00Z",
"duration":40,
"timezone":"Europe/Moscow",
"created_at":"2020-09-30T07:13:46Z",
"join_url":"https://us04web.zoom.us/j/76902907580?pwd=clUrV0NBcmRyd3RFbmUwRTM3WVJqUT09"
},
{
"uuid":"Uc0NFgdTSle3zZ4OgM4BOw==",
"id":71451895771,
"host_id":"MgQ_chc0Sx2aGLK2eq-_-w",
"topic":"первое мероприятие 1",
"type":2,
"start_time":"2020-09-30T13:30:00Z",
"duration":40,
"timezone":"Europe/Moscow",
"created_at":"2020-09-30T07:13:18Z",
"join_url":"https://us04web.zoom.us/j/71451895771?pwd=NThieHAyRG9CcmR1NTBVZkFheDhjUT09"
}]
}
)
*/
if($rez['err']==0){
$out['err']=0;
$json = json_decode($rez['response'],1);
$out['meetings'] = $json['meetings'];
}
return $out;
}
function zoom_meetingCreate($user,$param=array()){//Создание мероприятия от пользователя
GLOBAL $API; $out = array();
$out['err']=1;
$url = 'users/'.$user['id'].'/meetings';
if(!count($param)){
$post = array(
'topic'=>"первое мероприятие 1",
'type'=>2,
'start_time'=>"2020-09-30T13:30:00Z",
'duration'=>40,
'timezone'=>"Europe/Moscow",
'password'=>"ASD123_rf$"
);
}else{
$post = $param;
}
$rez = zoom_curl($url,$post);
if($rez['err']==0){
$json = json_decode($rez['response'],1);
if(isset($json['uuid'])){
$out['err']=0;
$out['meeting']=$json;
file_put_contents('zoom/'.$json['uuid'].'.json',json_encode($json));
/*Array(
[uuid] => +G+izsejS26d7QmpzpbWqA==
[id] => 76902907580
[host_id] => MgQ_chc0Sx2aGLK2eq-_-w
[host_email] => alneo.ru@yandex.ru
[topic] => первое мероприятие 1
[type] => 2
[status] => waiting
[start_time] => 2020-09-30T13:30:00Z
[duration] => 40
[timezone] => Europe/Moscow
[created_at] => 2020-09-30T07:13:46Z
[start_url] => https://us04web.zoom.us/s/76902907580?zak=eyJ6bV9za20iOiJ6bV9vMm0iLCJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJjbGllbnQiLCJ1aWQiOiJNZ1FfY2hjMFN4MmFHTEsyZXEtXy13IiwiaXNzIjoid2ViIiwic3R5IjoxMDAsIndjZCI6InVzMDQiLCJjbHQiOjAsInN0ayI6ImJ2NFItZXA3UVliMU5sRGJrbDU4VndzVERNbjR3Uk9KZDd0aktRNVhyOU0uQmdVZ1lVTmFiRGRDV1hWSFl6TlhUMEZ0ZFhBM1JuZDNUeXRRYm0xNFpteHNlVlpBWldRMk1qWTFaRFV4WXpZMlpESXdNRFkyTVdabE5Ea3hNVEk0WVRNMlpqZzFaREZoWVRVMU5UVTVOekF5TVdNME9XWXdabUZsTlRSbFpUSmhabVE1WkFBZ1dqUjFVblJzTnpOdFZVNTBPR2hIZUVWbVRGSTViblZTWnpWSWJqSmpaVk1BQkhWek1EUSIsImV4cCI6MTYwMTQ1NzIyNiwiaWF0IjoxNjAxNDUwMDI2LCJhaWQiOiI5VGM4bHg5RFNmTy1jaHAyWm56ZXNnIiwiY2lkIjoiIn0.VI3DbA9Hqu5QOSskA6e9Sxk0yKuIHh4IAC4QjohIT9Q
[join_url] => https://us04web.zoom.us/j/76902907580?pwd=clUrV0NBcmRyd3RFbmUwRTM3WVJqUT09
[password] => ASD123_rf$
[h323_password] => 0197207734
[pstn_password] => 0197207734
[encrypted_password] => clUrV0NBcmRyd3RFbmUwRTM3WVJqUT09
[settings] => Array(
[host_video] =>
[participant_video] =>
[cn_meeting] =>
[in_meeting] =>
[join_before_host] =>
[mute_upon_entry] =>
[watermark] =>
[use_pmi] =>
[approval_type] => 2
[audio] => voip
[auto_recording] => none
[enforce_login] =>
[enforce_login_domains] =>
[alternative_hosts] =>
[close_registration] =>
[registrants_confirmation_email] => 1
[waiting_room] => 1
[request_permission_to_unmute_participants] =>
[registrants_email_notification] => 1
[meeting_authentication] =>
)
)
*/
}
}
return $out;
}
function zoom_getUsers(){//Получение списка пользователей
$users = array();
$url = 'users?status=active&page_size=30&page_number=1';
$rez = zoom_curl($url);
if($rez['err']==0){
$json = json_decode($rez['response'],1);
$users = $json['users'];
}
return $users;
/*echo ''.print_r($rez,1).'
';
Array(
[err] => 0
[msg] => cURL Ok
[response] => {
"page_count":1,
"page_number":1,
"page_size":30,
"total_records":1,
"users":[
{
"id":"MgQ_chc0Sx2aGLK2eq-_-w",
"first_name":"Alexander",
"last_name":"Yakov",
"email":"alneo.ru@yandex.ru",
"type":1,
"pmi":5136867612,
"timezone":"Europe/Moscow",
"verified":1,
"dept":"",
"created_at":"2020-04-14T07:35:53Z",
"last_login_time":"2020-09-30T05:35:42Z",
"last_client_version":"5.0.24050.0510(android)",
"language":"ru-RU",
"phone_number":"",
"status":"active"
}
]
}
)
*/
}
function zoom_curl($url,$post=array()){
GLOBAL $API; $out = array();
$curl = curl_init();
$option = array(
CURLOPT_URL => $API['url'].$url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_HTTPHEADER => array(
"authorization: Bearer ".$API['JWTToken'],
"content-type: application/json"
),
);
if(count($post)){
$option[CURLOPT_CUSTOMREQUEST] = 'POST';
$option[CURLOPT_POSTFIELDS] = json_encode($post);
}else{
$option[CURLOPT_CUSTOMREQUEST] = 'GET';
}
curl_setopt_array($curl, $option);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
$out['err']=1;
$out['msg']='cURL Error #:' . $err;
} else {
$out['err']=0;
$out['msg']='cURL Ok';
$out['response']=$response;
}
return $out;
}