# Core PHP example of zoom API

**URL:** <https://devforum.zoom.us/t/core-php-example-of-zoom-api/40697>\
**Category:** API and Webhooks\
**Created:** [January 15, 2021, 5:39pm UTC](https://devforum.zoom.us/t/core-php-example-of-zoom-api/40697 "2021-01-15T17:39:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![grv](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@grv](https://devforum.zoom.us/u/grv)\
**Post date:** [January 15, 2021, 5:40pm UTC](https://devforum.zoom.us/t/core-php-example-of-zoom-api/40697/1 "2021-01-15T17:40:00Z")

</div>

Hi , I want to use Zoom API in my core PHP project .  
tried a lot examples but did not get the success.  
Currenlty using this .

\<?php require\_once 'config.php'; class Zoom\_Api { protected function sendRequest($data) { $request\_url = "https://api.zoom.us/v2/users/nawoapp1@gmail.com/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 jfklsjf342384flksjdfl", "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-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['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; } But i am stucking at the point that how can i pass the dynamic data in $postFields. please help..

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [January 19, 2021, 4:36pm UTC](https://devforum.zoom.us/t/core-php-example-of-zoom-api/40697/2 "2021-01-19T16:36:40Z")

</div>

Hi @grv ,

I can see we’ve already connected over email, so I will continue the conversation there.

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [February 19, 2021, 2:36am UTC](https://devforum.zoom.us/t/core-php-example-of-zoom-api/40697/3 "2021-02-19T02:36:41Z")

</div>

Closed on February 19, 2021, 2:36am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
