PHP
PHP
Activix CRM Upload a Recording
See more Activix CRM Examples
Upload a recording for an existing communication.Chilkat PHP Downloads
<?php
use Chilkat2\Http;
use Chilkat2\HttpRequest;
use Chilkat2\HttpResponse;
use Chilkat2\JsonObject;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
$req = new HttpRequest();
$req->HttpVerb = 'POST';
$req->Path = '/api/v2/communications/COMMUNICATION_ID/recording';
$req->ContentType = 'multipart/form-data';
$req->AddHeader('Accept', 'application/json');
$pathToFileOnDisk = 'qa_data/CantinaBand3.wav';
try {
$req->AddFileForUpload('recording', $pathToFileOnDisk);
$http = new Http();
$http->AuthToken = 'ACCESS_TOKEN';
$resp = new HttpResponse();
$http->HttpSReq('crm.activix.ca', 443, true, $req, $resp);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
echo 'Response Status Code: ', $resp->StatusCode, "\n";
$jsonResponse = new JsonObject();
$jsonResponse->Load($resp->BodyStr);
$jsonResponse->EmitCompact = false;
echo $jsonResponse->Emit(), "\n";
if ($resp->StatusCode >= 300) {
echo "Failed.\n";
exit;
}
// Sample output...
// {
// "message": "Recording uploaded successfully."
// }
//