<?php
$cr = curl_init("https://exam.nocortech.com/api/create-task"); # target URL
curl_setopt($cr, CURLOPT_POST, true); # use POST instead of default GET
$data =  array(
  "exam_no"     => 'EX-A20210001',
  "uid"         => array('9a7f0d289c66ce63','c7f660212bb6d5cb'),
  "start_time"  => '2021-05-07 16:50:00',
  "end_time"    => '2021-05-07 17:30:00',
  "company_id"  => '14'
);
curl_setopt($cr, CURLOPT_POSTFIELDS, json_encode($data)); # set post data and encode PHP object into JSON
curl_setopt($cr, CURLOPT_HTTPHEADER, array("Content-Type:application/json")); # key, set request Content-Type to application/json
curl_setopt($cr, CURLOPT_RETURNTRANSFER, true); # enabling allows return value through curl_exec
curl_setopt($cr, CURLOPT_FOLLOWLOCATION, true); # enabling allows to avoid a 307 temporarily redirect, I am not sure of the cause of the redirect
curl_exec($cr); # you get return value here
curl_close($cr);
?>
I hope this helps. I was working on PHP cURL too two days ago to link a website's backend with Gmail through Google App Script.
If anybody find any errors or mistakes in my solution, please point them out so that I can correct them.