네이버 클로버 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]
<?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개
terrorboy
8년 전
1일 제한 1만자
방구석기타리스트
7년 전
감사합니다~!
혹시... 반대는 없나요?
혹시... 반대는 없나요?
terrorboy
7년 전
아직 찾은게 없네요 ㅎㅎ
게시판 목록
개발자팁
개발과 관련된 유용한 정보를 공유하세요.
질문은 QA에서 해주시기 바랍니다.
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 5216 | 2년 전 | 953 | |||
| 5215 | 2년 전 | 1089 | |||
| 5214 | 2년 전 | 726 | |||
| 5213 | PHP |
swallow
|
2년 전 | 673 | |
| 5212 | PHP |
swallow
|
2년 전 | 1697 | |
| 5211 | PHP |
swallow
|
2년 전 | 1459 | |
| 5210 | PHP |
swallow
|
2년 전 | 2145 | |
| 5209 | PHP | 2년 전 | 695 | ||
| 5208 | JavaScript |
swallow
|
2년 전 | 835 | |
| 5207 | JavaScript |
swallow
|
2년 전 | 684 | |
| 5206 | JavaScript |
swallow
|
2년 전 | 609 | |
| 5205 | PHP |
|
2년 전 | 701 | |
| 5204 | 기타 |
techstar
|
2년 전 | 753 | |
| 5203 | JavaScript |
swallow
|
2년 전 | 577 | |
| 5202 | JavaScript |
swallow
|
2년 전 | 606 | |
| 5201 | JavaScript |
swallow
|
2년 전 | 671 | |
| 5200 | JavaScript |
swallow
|
2년 전 | 862 | |
| 5199 | JavaScript | 2년 전 | 624 | ||
| 5198 | 기타 |
swallow
|
2년 전 | 655 | |
| 5197 | PHP |
swallow
|
2년 전 | 734 | |
| 5196 | JavaScript |
swallow
|
2년 전 | 602 | |
| 5195 | PHP |
swallow
|
2년 전 | 2054 | |
| 5194 | PHP |
swallow
|
2년 전 | 615 | |
| 5193 | 기타 |
swallow
|
2년 전 | 668 | |
| 5192 | MySQL |
swallow
|
2년 전 | 1385 | |
| 5191 | JavaScript |
swallow
|
2년 전 | 1073 | |
| 5190 | PHP |
swallow
|
2년 전 | 1929 | |
| 5189 | MySQL |
swallow
|
2년 전 | 6189 | |
| 5188 | node.js |
swallow
|
2년 전 | 1047 | |
| 5187 | node.js |
swallow
|
2년 전 | 791 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기