Skip to content

Instantly share code, notes, and snippets.

@icywind
Created December 11, 2020 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icywind/68eb5d0c5102ee1f5398eac532ac145a to your computer and use it in GitHub Desktop.
Save icywind/68eb5d0c5102ee1f5398eac532ac145a to your computer and use it in GitHub Desktop.
Acquire a cloud record resource id
<?php
require_once("config.php");
$Channel = $_POST["channel"];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.agora.io/v1/apps/$AppID/cloud_recording/acquire",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\n \"cname\": \"$Channel\",\n \"uid\": \"$RecUID\",\n \"clientRequest\":{\n }\n}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Authorization: Basic $AuthSecret"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
/**
* Returns json {"resourceId":"xxxx"}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment