Integrate js rest api in php website

Description/Error
I have php website ,i want to create zoom user in parallel when a user registers to my website ,how i could possibly achieve this task
I included all the modules and configs needed
thats my registration i include this between script tags at the end of the file

	const axios = require('axios').default;
const config = require('./config');
const jwt = require('jsonwebtoken');

const payload = {
    iss: config.APIKey,
    exp: ((new Date()).getTime() + 5000)
};
const token = jwt.sign(payload, config.APISecret);
axios({
  method: 'post',
  url: 'https://api.zoom.us/v2/users',
  data: {
    'action': 'create',
    "user_info": {
      'email': 'testzoomphp@gmail.com',
      'type': 1,
      'first_name': 'Terry',
      'last_name': 'Jones',
    }
  },
  headers: {
    'Authorization': 'Bearer '+token,
    'User-Agent': 'Zoom-api-Jwt-Request',
    'content-type': 'application/json'
  }
})
.then(function(response) {
  //handle success
  console.log(response);
})
.catch(function(response) {
  //handle error
  console.log(response);
});

Hey @defconalert11,

It looks like the code you shared is JavaScript.

Are you getting errors when you try to create the user via PHP?

Thanks,
Tommy

@tommy sorry for lack of details I figured out a way to create a user but i have problem in creating meeting here is my code
userMeeting.php which is a file that displays users to create meeting with

          echo "   <tr>
      <td>".$value1['firstname']." ".$value1['lastname']."</td>
      <td> <form action='createZoomMeeting.js' method='POST'>
                            <input type='hidden' value='".$_SESSION['email']."' name='mentoremail' id='email' >
                                <button class='btn1 btn' type='submit' name='submit'>Connect</Button>
                                </form>
                              </td>
    </tr>
 ";

here is my createZoomMeeting.js

	const axios = require('axios').default;
const config = require('./config');
const jwt = require('jsonwebtoken');

const payload = {
    iss: config.APIKey,
    exp: ((new Date()).getTime() + 5000)
};
const token = jwt.sign(payload, config.APISecret);
var email = document.getElementById("email").value;

var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date+' T '+time;
axios({
  method: 'post',
  url: 'https://api.zoom.us/v2/users/'+email+'/meetings',
  data:{
  'topic': 'heyt',
  'type': '1',
  'start_time':dateTime,
  'duration': '30',
 
},
  headers: {
    'Authorization': 'Bearer '+token,
    'User-Agent': 'Zoom-api-Jwt-Request',
    'content-type': 'application/json'
  }
})
.then(function(response) {
  //handle success
alert("success");

})
.catch(function(response) {
  //handle error
alert("fail")
});

I want to get the email from the form which is 100% zoom user
here is my output seems that the file don’t run it displays the code

Hey @defconalert11,

As you said, action='createZoomMeeting.js' navigates to the JS file instead of running it. That is because it is trying to send a POST request to that file or endpoint.

You would need to change your createZoomMeeting.js to be a Node.js Express Server that accepts a POST request. Example here:

Let me know if that helps.

Otherwise, since you are already using PHP, you could do createZoomMeeting.php instead, and make the API request in PHP.

Thanks,
Tommy