1

I'm using VOICECLOUD API for transcription (Voice to Text). I call the API using CURL.

the result/response is: (-5 could not save file ) with no more details :(

Here is my code:

function CallAPI($url) {
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);

    print_r($result); //Always returns:  -5 could not save file 
}

$url = 'http://api.voicecloud.com/api.cgi?action=sendfile&username=MY+USER+NAME&devkey=11xxxx&idtype=username&fileurl=http://www.EXAMPLE.com/app/recordings/test.mp3&filetype=mp3&callerid=18xxxxxxxx';
CallAPI($url);  
4

1 に答える 1

0

APIは、パラメータを で渡す必要があると述べていますGET

したがって、$data配列を次のように変更します

$val=http_build_query($data);
$url='http://api.voicecloud.com/api.cgi';
$url.=$val;//Appending the params to the URL

CALLAPI()そしてあなたの好きを変えてください

function CallAPI($method, $url, $data = false) {
    $curl = curl_init();
    //curl_setopt($curl, CURLOPT_POST, 1);//Commmented
    //curl_setopt($curl, CURLOPT_POSTFIELDS, $data);//Commented
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);

    print_r($result);
    curl_close($curl);
}
于 2013-10-26T07:35:27.977 に答える