- Creating New Voice File
[[API:Function]] – goAddVoiceFiles
-
This application is used to create new audio file . Newly created audio file belongs to user that authenticated a request.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
Returns:
result – “success” means that voice file has been created. String
result – “error” means that voice file has not been created, containing the error occurred. String
-
Error: Upload Failed.
audiofile – created audiofile. String
Sample Code:
<?php
$url = "https://YOUR_URL/goAPI/goVoiceFiles/goAPI.php"; #URL to GoAutoDial API. (required)
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]. (required)
$postfields["responsetype"] = "json"; #json. (required)
$postfields["audiofile"] = ""; #voice file. (required)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
// print_r($data);
if ($output->result=="success") {
# Result was OK!
echo "Uploaded a WAV file: ";
} else {
# An error occured
echo $output->result;
}
?>
-
- Displaying Voice File
[[API:Function]] – goGetVoiceFilesList
-
This application is used to get list of voice file belongs to user.
Mandatory parameters from “postfields” variables:
-
goUser- Username. String
-
goPass- Password. String
-
goAction- Action performed by the [[API:Functions]]. String
Returns:result – “success” means that query was successful. String
result – “error” means that query was not successful. , containing the error occurred. String
file_name – name of the audio file. String
file _date – date of file uploaded. Date
file_size– size of the audio file. Integer
Sample Code:
?php
$url = "https://YOUR_URL/goAPI/goVoiceFiles/goAPI.php"; #URL to GoAutoDial API. (required)
$postfields["goUser"] = ""; #Username goes here. (required)
$postfields["goPass"] = ""; #Password goes here. (required)
$postfields["goAction"] = ""; #action performed by the [[API:Functions]]. (required)
$postfields["responsetype"] = "json"; #json. (required)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
curl_close($ch);
$output = json_decode($data);
// print_r($data);
if ($output->result=="success") {
# Result was OK!
for($i=0;$i<count($output->file_name);++$i){
echo $output->file_name[$i]."</br>";
echo $output->file_date[$i]."</br>";
echo $output->file_size[$i]."</br>";
}
} else {
# An error occured
echo $output->result;
}
?>
-
VOICE FILE
- 973 Користувачі, які знайшли це корисним