<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/voice-profile/clone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'engine' => '<string>',
'credential_id' => '<string>',
'model' => '<string>',
'audio_base64' => '<string>',
'audio_filename' => 'voice.wav',
'audio_url' => '<string>',
'text' => '<string>',
'prefix' => 'agentscope',
'consent' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-user-id: <x-user-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}