탈

네이버 클로버 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-11-24 조회 2,628
jQuery 17-11-24 조회 2,728
jQuery 17-11-21 조회 2,952
jQuery 17-11-21 조회 3,185
jQuery 17-11-21 조회 2,386
jQuery 17-11-10 조회 3,383
jQuery 17-11-10 조회 2,843
jQuery
[jQuery]
17-11-10 조회 2,179
JavaScript 17-11-09 조회 3,276
jQuery
[jQuery]
17-11-08 조회 2,002
jQuery 17-11-08 조회 2,277
jQuery 17-11-08 조회 2,364
jQuery 17-10-24 조회 2,146
jQuery 17-10-24 조회 2,213
jQuery
[jQuery]
17-10-24 조회 1,911
jQuery 17-10-20 조회 2,526
jQuery 17-10-20 조회 2,953
jQuery
[jQuery]
17-10-20 조회 2,245
jQuery 17-10-19 조회 1,946
jQuery
[jQuery]
17-10-19 조회 2,362
jQuery 17-10-19 조회 5,967
기타 17-10-19 조회 3,693
jQuery
[jQuery]
17-10-17 조회 2,091
jQuery 17-10-17 조회 2,248
jQuery 17-10-17 조회 2,350
PHP 17-10-16 조회 5,658
node.js 17-10-13 조회 4,721
jQuery 17-10-12 조회 2,743
jQuery 17-10-12 조회 2,176
jQuery 17-10-12 조회 1,746