네이버 클로버 tts

· 2017-10-16 (월) 11:43:52 · 5609 · 3
[code]
<?php
$client_id = "";
$client_secret = "";
$txt = $_GET['txt'];
if(!$txt) $txt = '텍스트 파라미터를 입력 바랍니다.';
$encText = urlencode($txt);
$postvars = "speaker=mijin&speed=0&text=".$encText;
$url = "https://openapi.naver.com/v1/voice/tts.bin";
$is_post = true;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $is_post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, $postvars);
$headers = array();
$headers[] = "X-Naver-Client-Id: ".$client_id;
$headers[] = "X-Naver-Client-Secret: ".$client_secret;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec ($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close ($ch);
if($status_code == 200) {
header("Content-type: audio/mpeg");
header("Content-Transfer-Encoding: binary");
header('Pragma: no-cache');
header('Expires: 0');
echo $response;
} else {
echo "Error 내용:".$response;
}
[/code]
|

댓글 3개

2017-10-16 (월) 11:44:27
1일 제한 1만자
2018-06-19 (화) 20:40:48
감사합니다~!
혹시... 반대는 없나요?
2018-06-19 (화) 20:56:34
아직 찾은게 없네요 ㅎㅎ
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
jQuery 17-11-24 조회 2,535
jQuery 17-11-24 조회 2,692
jQuery 17-11-21 조회 2,917
jQuery 17-11-21 조회 3,129
jQuery 17-11-21 조회 2,342
jQuery 17-11-10 조회 3,340
jQuery 17-11-10 조회 2,803
jQuery
[jQuery]
17-11-10 조회 2,151
JavaScript 17-11-09 조회 3,237
jQuery
[jQuery]
17-11-08 조회 1,961
jQuery 17-11-08 조회 2,230
jQuery 17-11-08 조회 2,331
jQuery 17-10-24 조회 2,109
jQuery 17-10-24 조회 2,184
jQuery
[jQuery]
17-10-24 조회 1,868
jQuery 17-10-20 조회 2,434
jQuery 17-10-20 조회 2,912
jQuery
[jQuery]
17-10-20 조회 2,202
jQuery 17-10-19 조회 1,894
jQuery
[jQuery]
17-10-19 조회 2,326
jQuery 17-10-19 조회 5,920
기타 17-10-19 조회 3,657
jQuery
[jQuery]
17-10-17 조회 2,049
jQuery 17-10-17 조회 2,207
jQuery 17-10-17 조회 2,298
PHP 17-10-16 조회 5,610
node.js 17-10-13 조회 4,646
jQuery 17-10-12 조회 2,695
jQuery 17-10-12 조회 2,138
jQuery 17-10-12 조회 1,671