Plus
curl_setopt ($ch, Curlopt_ssl_verifypeer,FALSE);
You can do it.
Baidu's Voice Demo:
<?PHPHeader("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_id=".$apiKey." &client_secret= ".$secretKey;$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)){ PrintCurl_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 '). " &cuid= ".Double($cuid)." &ctp= ".Double(' 1 '). " &tok= ".Double($token);$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)){ PrintCurl_error ($ch);} Curl_close ($ch);Echo $response;$response= Json_decode ($response,true);Var_dump($response);?>
PHP SSL certificate problem:unable to get local issuer certificate