I made a post request for an api using ajax. I wonder how I can do the same in php.
<script type="text/javascript">
  var cbIntegrationId = "xxxxxx"; // I have it
  var clientId = "xxxxxxx"; //I have it
  var clientSecret = "xxxxx"; //I have it
  var tableName = "Test_Database";
    //Get access token
    $.post(
      "https://" + cbIntegrationId + ".caspio.com/oauth/token",
      {
        grant_type: "client_credentials",
        client_id: clientId,
        client_secret: clientSecret
      },
      function(cbAuth){
        //Run POST call
        $.ajax({
          url: "https://" + cbIntegrationId + ".caspio.com/rest/v2/tables/" + tableName + "/records?response=rows",
          type: 'POST',
          'data': JSON.stringify({"UniqueID":"988"}), //Define record values
          headers: {
            "Authorization": "Bearer " + cbAuth.access_token, //Extracts the access token from the initial authorization call
            "Content-Type": "application/json", //Required, otherwise 415 error is returned
            "Accept": "application/json"
          },
          dataType: 'json',
          success: function (data) {
            console.log(data.Result); //Check the console to view the new added row
          },
          error: function(data) {
            console.log(data.responseJSON); //Check the console to view error message if any
          }
        });
      }
    );
</script>
I did some research but couldn't find anything that would solve my problem. I really need your help.
 
    