Search
 
SCRIPT & CODE EXAMPLE
 

PHP

How to on auto_recording using zoom api in php

<?php

require_once 'config.php';


class Zoom_Api
{


    protected function sendRequest($data)
    {
        $request_url = "https://api.zoom.us/v2/users//meetings";




        $postFields =  '{
        "topic": "New Meeting",
        "type": 2,
        "start_time": "2020-08-09T12:00:00Z",
        "duration": 45,
        "timezone": "America/Anchorage",
        "password": "1234",
        "agenda": "Zoom WordPress",
        "tracking_fields": [
          {
            "field": "string",
            "value": "string"
          }
        ],
        "settings": {
          "host_video": true,
          "participant_video": true,
          "cn_meeting": false,
          "in_meeting": false,
          "join_before_host": false,
          "mute_upon_entry": true,
          "watermark": false,
          "use_pmi": false,
          "approval_type": 0,
          "registration_type": 1,
          "audio":"voip", 
          "enforce_login": false,
          "enforce_login_domains": "",
          "alternative_hosts": "",
          "registrants_email_notification": false
        }
      }';



        $ch = curl_init();





        curl_setopt_array($ch, array(
            CURLOPT_URL => $request_url,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => "POST",
            CURLOPT_POSTFIELDS => $postFields,
            CURLOPT_HTTPHEADER => array(
                "authorization: Bearer",
                "content-type: application/json",
                "Accept: application/json",
            ),
        ));


        $response = curl_exec($ch);
        $err = curl_error($ch);
        curl_close($ch);
        if (!$response) {
            return $err;
        }
        return json_decode($response);
    }

    public function createAMeeting($data = array())
    {
        $post_time  = $data['start_date'];
        $start_time = gmdate("Y-m-dTH:i:s", strtotime($post_time));
        $createAMeetingArray = array();
        if (!empty($data['alternative_host_ids'])) {
            if (count($data['alternative_host_ids']) > 1) {
                $alternative_host_ids = implode(",", $data['alternative_host_ids']);
            } else {
                $alternative_host_ids = $data['alternative_host_ids'][0];
            }
        }
        $createAMeetingArray['topic']      = $data['topic'];
        $createAMeetingArray['agenda']     = !empty($data['agenda']) ? $data['agenda'] : "";
        $createAMeetingArray['type']       = !empty($data['type']) ? $data['type'] : 2; //Scheduled
        $createAMeetingArray['start_time'] = $start_time;
        $createAMeetingArray['timezone']   = 'PST';
        $createAMeetingArray['password']   = !empty($data['password']) ? $data['password'] : "";
        $createAMeetingArray['duration']   = !empty($data['duration']) ? $data['duration'] : 60;
        $createAMeetingArray['settings']   = array(
            'join_before_host'  => !empty($data['join_before_host']) ? true : false,
            'host_video'        => !empty($data['option_host_video']) ? true : false,
            'participant_video' => !empty($data['option_participants_video']) ? true : false,
            'mute_upon_entry'   => !empty($data['option_mute_participants']) ? true : false,
            'enforce_login'     => !empty($data['option_enforce_login']) ? true : false,
            'auto_recording'    => !empty($data['option_auto_recording']) ? $data['option_auto_recording'] : "none",
            'alternative_hosts' => isset($alternative_host_ids) ? $alternative_host_ids : ""
        );
        return $this->sendRequest($createAMeetingArray);
    }
}


$zoom_meeting = new Zoom_Api();
try {

    $z = $zoom_meeting->createAMeeting(
        array(
            'start_date' => date("Y-m-d h:i:s", strtotime('tomorrow')),
            'topic' => 'Example Test Meeting'
        )
    );
    echo json_encode($z);
} catch (Exception $ex) {
    echo $ex;
}
Comment

PREVIOUS NEXT
Code Example
Php :: upgrade phpopensuse 
Php :: laravel How to apply Eloquent where() to child in hasMany() relationship 
Php :: levenshtein (PHP 4 = 4.0.1, PHP 5, PHP 7, PHP 8) levenshtein — Calculate Levenshtein distance between two strings 
Php :: phpunit exception message contains string 
Php :: old codestar radio field 
Php :: PHP 7 - Fatal error: Call to undefined method PDF::FPDF() 
Php :: what does the initals of php stand for? 
Php :: provenienza geografica di un utente php webmaster 
Php :: how to color php text 
Php :: mysqldump is not recognized as an internal or external command laravel 
Php :: PHP OOP - Static Methods 
Php :: if data come from foreach loop and if there are same value then sum of this same value and pass it to variable in php 
Php :: if condition in laravel blade in select option 
Php :: child data retrive without timestamp laravel 
Php :: IlluminateValidationRulesRequiredIf 
Php :: php post http 
Php :: php preg_match 
Php :: lowercase in array php 
Php :: push element in array php 
Php :: subquery in laravel 
Php :: Laravel 9 Route problem return 404 NOT FOUND 
Php :: how to create php message 1 
Php :: php include file from file included before 
Php :: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/7.3.27 Server at localhost Port 80 
Java :: androidx recyclerview dependency 
Java :: change java version command line debian 
Java :: how to check if recyclerview is empty 
Java :: starting code of java 
Java :: java time code 
Java :: gradle springboot run 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =