네이버 클로버 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에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 5066 | 기타 |
DogFoot개발
|
4년 전 | 1818 | |
| 5065 | PHP |
DogFoot개발
|
4년 전 | 1529 | |
| 5064 | PHP |
happyl
|
4년 전 | 1916 | |
| 5063 | node.js |
DogFoot개발
|
4년 전 | 1674 | |
| 5062 | node.js |
DogFoot개발
|
4년 전 | 1692 | |
| 5061 | node.js |
DogFoot개발
|
4년 전 | 1414 | |
| 5060 | node.js |
DogFoot개발
|
4년 전 | 1254 | |
| 5059 | node.js |
DogFoot개발
|
4년 전 | 1250 | |
| 5058 | 기타 |
DogFoot개발
|
4년 전 | 2697 | |
| 5057 | 웹서버 |
DogFoot개발
|
4년 전 | 2726 | |
| 5056 | MySQL | 4년 전 | 1504 | ||
| 5055 | 기타 | 4년 전 | 1435 | ||
| 5054 | OS | 4년 전 | 2069 | ||
| 5053 | 웹서버 | 4년 전 | 3631 | ||
| 5052 | OS | 4년 전 | 2423 | ||
| 5051 | PHP | 4년 전 | 2187 | ||
| 5050 | 웹서버 | 4년 전 | 1720 | ||
| 5049 | MySQL | 4년 전 | 1899 | ||
| 5048 | OS | 4년 전 | 2703 | ||
| 5047 | PHP | 4년 전 | 4374 | ||
| 5046 | MySQL | 4년 전 | 1819 | ||
| 5045 | MySQL | 4년 전 | 1943 | ||
| 5044 | MySQL | 4년 전 | 4134 | ||
| 5043 | MySQL | 4년 전 | 1891 | ||
| 5042 | 기타 |
|
4년 전 | 2635 | |
| 5041 | MySQL | 4년 전 | 1998 | ||
| 5040 | MySQL | 4년 전 | 1725 | ||
| 5039 | MySQL | 4년 전 | 1497 | ||
| 5038 | MySQL | 4년 전 | 1336 | ||
| 5037 | OS | 4년 전 | 4432 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기