t

네이버 클로버 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만자
감사합니다~!
혹시... 반대는 없나요?
아직 찾은게 없네요 ㅎㅎ
댓글을 작성하시려면 로그인이 필요합니다. 로그인

개발자팁

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

+
분류 제목 글쓴이 날짜 조회
jQuery 8년 전 조회 1,836
jQuery 8년 전 조회 1,661
jQuery 8년 전 조회 1,674
jQuery
[jQuery]
8년 전 조회 1,357
jQuery 8년 전 조회 1,991
jQuery 8년 전 조회 2,443
jQuery
[jQuery]
8년 전 조회 1,728
jQuery 8년 전 조회 1,439
jQuery
[jQuery]
8년 전 조회 1,857
jQuery 8년 전 조회 5,445
기타 8년 전 조회 3,183
jQuery
[jQuery]
8년 전 조회 1,560
jQuery 8년 전 조회 1,737
jQuery 8년 전 조회 1,836
PHP 8년 전 조회 5,160
node.js 8년 전 조회 4,161
jQuery 8년 전 조회 2,233
jQuery 8년 전 조회 1,675
jQuery 8년 전 조회 1,227
jQuery 8년 전 조회 1,949
jQuery 8년 전 조회 1,449
jQuery 8년 전 조회 1,560
jQuery 8년 전 조회 1,784
jQuery 8년 전 조회 2,019
jQuery 8년 전 조회 1,554
jQuery 8년 전 조회 1,488
jQuery 8년 전 조회 1,581
jQuery
[jQuery]
8년 전 조회 1,466
jQuery 8년 전 조회 1,594
jQuery 8년 전 조회 1,642
🐛 버그신고