Notes
Notes - notes.io |
$this->registerJsFile("https://source.zoom.us/2.6.0/lib/vendor/react.min.js", ['position' => yiiwebView::POS_HEAD]);
$this->registerJsFile("https://source.zoom.us/2.6.0/lib/vendor/react-dom.min.js", ['position' => yiiwebView::POS_HEAD]);
$this->registerJsFile("https://source.zoom.us/2.6.0/lib/vendor/redux.min.js", ['position' => yiiwebView::POS_HEAD]);
$this->registerJsFile("https://source.zoom.us/2.6.0/lib/vendor/redux-thunk.min.js", ['position' => yiiwebView::POS_HEAD]);
$this->registerJsFile("https://source.zoom.us/2.6.0/zoom-meeting-2.6.0.min.js", ['position' => yiiwebView::POS_HEAD]);
?>
namespace appcomponents;
use Yii;
use yiibaseComponent;
use yiihttpclientClient;
class ZoomAPI extends Component
{
public $apiKey;
public $apiSecret;
public $zoomApiBaseUrl = 'https://api.zoom.us/v2/';
public function init()
{
$this->apiKey = Yii::$app->params['zoomApiKey'];
$this->apiSecret = Yii::$app->params['zoomApiSecret'];
}
private function generateJWT()
{
$header = json_encode(['alg' => 'HS256', 'typ' => 'JWT']);
$payload = json_encode(['iss' => $this->apiKey, 'exp' => time() + 3600]);
$base64UrlHeader = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($header));
$base64UrlPayload = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($payload));
$signature = hash_hmac('sha256', $base64UrlHeader . "." . $base64UrlPayload, $this->apiSecret, true);
$base64UrlSignature = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($signature));
return $base64UrlHeader . "." . $base64UrlPayload . "." . $base64UrlSignature;
}
public function createMeeting($data)
{
$client = new Client(['baseUrl' => $this->zoomApiBaseUrl]);
$jwt = $this->generateJWT();
$response = $client->post('users/me/meetings', $data, [
'Authorization' => 'Bearer ' . $jwt,
'Content-Type' => 'application/json',
])->send();
return $response->isOk ? $response->data : null;
}
}
return [
'zoomApiKey' => 'YOUR_ZOOM_API_KEY',
'zoomApiSecret' => 'YOUR_ZOOM_API_SECRET',
];
$zoomApi = Yii::$app->zoomApi;
$meetingData = [
'topic' => 'Yii2 Zoom Meeting',
'type' => 2, // Scheduled meeting
'start_time' => '2024-10-01T10:00:00Z',
'duration' => 30, // 30 minutes
'timezone' => 'UTC',
];
$meeting = $zoomApi->createMeeting($meetingData);
if ($meeting) {
echo "Meeting created! Join URL: " . $meeting['join_url'];
} else {
echo "Failed to create meeting.";
}
<div id="zmmtg-root"></div>
<div id="aria-notify-area"></div>
<div id="meetingSDKElement">
<!-- Zoom Meeting will be embedded here -->
</div>
<script>
ZoomMtg.setZoomJSLib('https://source.zoom.us/2.6.0/lib', '/av');
ZoomMtg.preLoadWasm();
ZoomMtg.prepareJssdk();
const apiKey = "YOUR_ZOOM_API_KEY";
const meetingNumber = "YOUR_MEETING_NUMBER"; // From Zoom API response
const role = 1; // 1 = host, 0 = attendee
const leaveUrl = "http://your-app-url.com/"; // URL after leaving the meeting
const userName = "Yii2 User";
const userEmail = ""; // optional, recommended for attendees
const passWord = "YOUR_MEETING_PASSWORD"; // From Zoom API response
ZoomMtg.init({
leaveUrl: leaveUrl,
success: function () {
ZoomMtg.join({
meetingNumber: meetingNumber,
userName: userName,
signature: generateSignature(apiKey, meetingNumber, role),
apiKey: apiKey,
userEmail: userEmail,
passWord: passWord,
success: function (res) {
console.log("join meeting success");
},
error: function (res) {
console.log(res);
}
});
},
error: function (res) {
console.log(res);
}
});
function generateSignature(apiKey, meetingNumber, role) {
const timestamp = new Date().getTime() - 30000;
const msg = apiKey + meetingNumber + timestamp + role;
const hash = CryptoJS.HmacSHA256(msg, "YOUR_ZOOM_API_SECRET");
const signature = Buffer.from(apiKey + '.' + meetingNumber + '.' + timestamp + '.' + role + '.' + hash.toString(CryptoJS.enc.Base64));
return signature.toString('base64');
}
</script>
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team
