我尝试在NEXMO中执行文本到语音API,但我有一个错误:
$phoneno = "Checkthisout";
$params = "api_key=XXXX&api_secret=XXXXX&to=XXXXX&from=XXXXXX&text=".$phoneno;
$url = 'https://api.nexmo.com/tts/json?'; . http_build_query($params);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
print_r($response);但是得到了新的错误{"status":"2","error_text":"Missing username"}
按照URL:https://nexmo.github.io/Quickstarts/tts/完成。
我检查了他们所有的文件。我没有看到这样的错误文本。有人能帮帮我吗?
发布于 2015-07-22 20:02:30
正如Marc所提到的,它需要参数数组,而不是字符串。
$params = [
'api_key' => XXXXX,
'api_secret' => XXXXX,
'to' => YOUR_NUMBER,
'from' => NEXMO_NUMBER,
'text' => 'Checkthisout',
];
$url = 'https://api.nexmo.com/tts/json?' . http_build_query($params);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);您可以观看此视频进行快速演练:文本到语音快速启动视频
我在Nexmo工作。
下面是关于如何实现文本到言语的更详细的文档
https://stackoverflow.com/questions/31570493
复制相似问题