在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
加上 curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE); 就可以了
百度语音的demo: <?php header("Content-type:audio/mp3; charset=utf-8"); //put your params here $cuid = "9619439"; $apiKey = "gSwM3lYXkKXp5dDuU6zBjHrr"; $secretKey = "ff9c651db48ac780c85eed057c593e89"; $auth_url = "https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_>; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $auth_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE); $response = curl_exec($ch); if(curl_errno($ch)) { print curl_error($ch); } curl_close($ch); $response = json_decode($response, true); $token = $response['access_token']; function double ($a) { return urlencode(urlencode($a)); } $url = "http://tsn.baidu.com/text2audio?tex=".double('123')."&lan=".double('zh')."&cu>); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE); $response = curl_exec($ch); if(curl_errno($ch)) { print curl_error($ch); } curl_close($ch); echo $response; $response = json_decode($response, true); var_dump($response); ?>
|
2022-08-17
2022-07-18
2022-11-06
2022-08-17
2022-07-30
请发表评论