调用“微信AI开放接口-提交语音” 接口时,老是不成功,返回{“errcode”:-1,“errmsg”:“system error hint: [********]”},文档中也没有具体例子。请教一下这个怎么才能调用成功,能不能给个具体例子?谢谢!
$file = $_FILES[‘file’];//上传的mp3文件
$fileKey = $fileFolder . md5(mt_rand()) . ‘-’ . $file[‘name’];
$body = file_get_contents($file[‘tmp_name’]);
//以下是调用"微信AI开放接口-提交语音"
$access_token = $this->get_accessToken();
$url = ‘http://api.weixin.qq.com/cgi-bin/media/voice/addvoicetorecofortext?access_token=’ . $access_token . ‘&format=&voice_id=’ . $fileKey . ‘&lang=zh_CN’;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, base64_encode($body));
$data = json_decode(curl_exec($ch));
curl_close($ch);
return $data->errmsg;