탈

네이버 클로버 tts

[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개

1일 제한 1만자
감사합니다~!
혹시... 반대는 없나요?
아직 찾은게 없네요 ㅎㅎ
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

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

+
분류 제목 글쓴이 날짜 조회
jQuery 17-10-11 조회 2,489
jQuery 17-10-11 조회 1,958
jQuery 17-10-11 조회 2,062
jQuery 17-09-29 조회 2,284
jQuery 17-09-29 조회 2,519
jQuery 17-09-29 조회 2,064
jQuery 17-09-26 조회 1,991
jQuery 17-09-26 조회 2,079
jQuery
[jQuery]
17-09-26 조회 1,851
jQuery 17-09-22 조회 2,098
jQuery 17-09-22 조회 2,157
jQuery 17-09-22 조회 2,126
jQuery 17-09-21 조회 2,322
jQuery 17-09-21 조회 2,270
jQuery 17-09-21 조회 2,138
jQuery 17-09-19 조회 2,195
jQuery 17-09-19 조회 1,960
jQuery
[jQuery]
17-09-19 조회 1,937
jQuery
[jQuery]
17-09-18 조회 2,104
jQuery 17-09-18 조회 2,016
jQuery 17-09-18 조회 1,712
jQuery 17-09-14 조회 2,138
jQuery 17-09-14 조회 1,820
jQuery 17-09-14 조회 2,059
jQuery 17-09-11 조회 2,456
jQuery 17-09-11 조회 2,487
jQuery 17-09-11 조회 2,006
jQuery 17-09-10 조회 2,066
jQuery 17-09-10 조회 2,504
jQuery
[jQuery]
17-09-10 조회 1,959