Description
When i am passing time to zoom api it does not schedule meeting on my mention time and in repsonse i am getting incorrect time which i have pass to api
I am passing the date time which is 2020-07-02 13:20:00 and time zone Asia/Tashkent here is the response which i am getting after passing mention time:-
stdClass Object
(
[uuid] =>
[id] => ***********
[host_id] =>
[topic] => czdcadc
[type] => 2
[status] => waiting
[start_time] => 2020-07-02T03:20:00Z
[duration] => 60
[timezone] => Asia/Tashkent
[created_at] => 2020-06-30T06:54:25Z
[password] =>
[h323_password] =>
[pstn_password] =>
[encrypted_password] =>
[settings] => stdClass Object
(
[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
[registrants_email_notification] => 1
[meeting_authentication] =>
)
)
Here is my code:
protected function sendRequest($data) {
$request_url = ‘https://api.zoom.us/v2/users/me/meetings’;
$headers = array(
"authorization: Bearer ".$this->generateJWTKey(),
‘content-type: application/json’
);
$postFields = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if(!$response){
return $err;
}
return json_decode($response);
}
//function to generate JWT
private function generateJWTKey() {
$key = $this->zoom_api_key;
$secret = $this->zoom_api_secret;
$token = array(
“iss” => $key,
“exp” => time() + 3600 //60 seconds as suggested
);
// $token = “”;
return JWT::encode( $token, $secret );
}
public function createAMeeting( $data = array() ) {
$post_time = $data[‘start_date’];
$start_time = gmdate( “Y-m-d\TH: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[‘meetingTopic’];
$createAMeetingArray[‘agenda’] = ! empty( $data[‘agenda’] ) ? $data[‘agenda’] : “”;
$createAMeetingArray[‘type’] = ! empty( $data[‘type’] ) ? $data[‘type’] : 2; //Scheduled
$createAMeetingArray[‘start_time’] = $start_time;
$createAMeetingArray[‘timezone’] = $data[‘timezone’];
$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);
}
This is the function which i am running to create meeting
function Hellozoom($title,$md,$mt,&$resp=array()){
try{
$z = $this->createAMeeting(
array(
‘start_date’=>date(“Y-m-d H:i:s”, strtotime($md." ".$mt)),
‘meetingTopic’=>$title,
‘timezone’=>‘Asia/Tashkent’
)
);
$resp=$z;
//print_r($z);
} catch (Exception $ex) {
echo $ex;
}
}
*This post has been edited to remove any meeting / webinar IDs