처리 과정
api이용하여 날씨정보를 불러와 텍스트를 음성리 변환 mp3 인코딩되어 보이스 액세스 음성처리 합니다.
모든 브라우저에서 작동합니다.
해당 코드를 보시면 7번째줄에 도시명을 넣는 곳이 있어요 맞게 넣으시면 됩니다.
###초보자를 위한 설치 방법 #####
그누보드가 설치되어있는 폴더에 ds.php 넣어주세요
그런후 메인 페이지에 위치 할곳에 아래처럼 하시면 됩니다.
<? include ("$g4[path]/ds.php") ?>
샘플 http://honeymusic.kr/ds.php
더많은 참고 자료 http://sir.co.kr/bbs/board.php?bo_table=g4_skin&sca=&sfl=mb_id%2C1&stx=density2002
api이용하여 날씨정보를 불러와 텍스트를 음성리 변환 mp3 인코딩되어 보이스 액세스 음성처리 합니다.
모든 브라우저에서 작동합니다.
해당 코드를 보시면 7번째줄에 도시명을 넣는 곳이 있어요 맞게 넣으시면 됩니다.
###초보자를 위한 설치 방법 #####
그누보드가 설치되어있는 폴더에 ds.php 넣어주세요
그런후 메인 페이지에 위치 할곳에 아래처럼 하시면 됩니다.
<? include ("$g4[path]/ds.php") ?>
샘플 http://honeymusic.kr/ds.php
더많은 참고 자료 http://sir.co.kr/bbs/board.php?bo_table=g4_skin&sca=&sfl=mb_id%2C1&stx=density2002
댓글 15개
11년 전
처리 과정
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<?php
//*Copyright © HoneyMusic*
//*Yu-sung heon *
//*density2002@naver.com *
$url = "http://api.wunderground.com/api/e9e0b719ce8b9e95/geolookup/conditions/lang:KR/q/Korea/Cheongju.json.json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$return = curl_exec($ch);
curl_close($ch);
$json_string = $return;
$parsed_json = json_decode($json_string);
$location = $parsed_json->{'location'}->{'city'};
$temp_f = $parsed_json->{'current_observation'}->{'temp_f'};
$temp_c = $parsed_json->{'current_observation'}->{'temp_c'};
$uv = $parsed_json->{'current_observation'}->{'UV'};
$wind_kph = $parsed_json->{'current_observation'}->{'wind_kph'};
$weather = $parsed_json->{'current_observation'}->{'weather'};
$icon_url = $parsed_json->{'current_observation'}->{'icon_url'};
$api = "현재 날씨를 알려 드리겠습니다 $location 에는 섭씨$temp_f 도씨이며 온도 $temp_c 도씨입니다.현재날씨는 $weather 입니다. 풍속은 $wind_kph 입니다. 좋은 하루되십시요\n";
$apidata = "$location 온도: $temp_c 섭씨: $temp_f 날씨: $weather \n";
class TextToSpeech {
public $mp3data;
function __construct($text="") {
$text = trim($text);
if(!empty($text)) {
$text = urlencode($text);
$url = "http://translate.google.com/translate_tts?ie=utf-8&tl=ko&q=".$text;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$return = curl_exec($ch);
curl_close($ch);
$this->mp3data = $return;
}
}
function setText($text) {
$text = trim($text);
if(!empty($text)) {
$text = urlencode($text);
$url = "http://translate.google.com/translate_tts?ie=utf-8&tl=ko&q=".$text;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$return = curl_exec($ch);
curl_close($ch);
$this->mp3data = $return;
return $mp3data;
} else { return false; }
}
function saveToFile($filename) {
$filename = trim($filename);
if(!empty($filename)) {
return file_put_contents($filename,$this->mp3data);
} else { return false; }
}
}
$data=$api;
$tts = new TextToSpeech();
$tts->setText($data);
$tts->saveToFile("masnun.mp3");
?>
<audio controls="controls" autoplay="autoplay">
<source src="masnun.mp3" type="audio/mpeg"/>
</audio><br>
<img src="<?=$icon_url;?>" height="30" ><? echo $apidata; ?>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<?php
//*Copyright © HoneyMusic*
//*Yu-sung heon *
//*density2002@naver.com *
$url = "http://api.wunderground.com/api/e9e0b719ce8b9e95/geolookup/conditions/lang:KR/q/Korea/Cheongju.json.json";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$return = curl_exec($ch);
curl_close($ch);
$json_string = $return;
$parsed_json = json_decode($json_string);
$location = $parsed_json->{'location'}->{'city'};
$temp_f = $parsed_json->{'current_observation'}->{'temp_f'};
$temp_c = $parsed_json->{'current_observation'}->{'temp_c'};
$uv = $parsed_json->{'current_observation'}->{'UV'};
$wind_kph = $parsed_json->{'current_observation'}->{'wind_kph'};
$weather = $parsed_json->{'current_observation'}->{'weather'};
$icon_url = $parsed_json->{'current_observation'}->{'icon_url'};
$api = "현재 날씨를 알려 드리겠습니다 $location 에는 섭씨$temp_f 도씨이며 온도 $temp_c 도씨입니다.현재날씨는 $weather 입니다. 풍속은 $wind_kph 입니다. 좋은 하루되십시요\n";
$apidata = "$location 온도: $temp_c 섭씨: $temp_f 날씨: $weather \n";
class TextToSpeech {
public $mp3data;
function __construct($text="") {
$text = trim($text);
if(!empty($text)) {
$text = urlencode($text);
$url = "http://translate.google.com/translate_tts?ie=utf-8&tl=ko&q=".$text;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$return = curl_exec($ch);
curl_close($ch);
$this->mp3data = $return;
}
}
function setText($text) {
$text = trim($text);
if(!empty($text)) {
$text = urlencode($text);
$url = "http://translate.google.com/translate_tts?ie=utf-8&tl=ko&q=".$text;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$return = curl_exec($ch);
curl_close($ch);
$this->mp3data = $return;
return $mp3data;
} else { return false; }
}
function saveToFile($filename) {
$filename = trim($filename);
if(!empty($filename)) {
return file_put_contents($filename,$this->mp3data);
} else { return false; }
}
}
$data=$api;
$tts = new TextToSpeech();
$tts->setText($data);
$tts->saveToFile("masnun.mp3");
?>
<audio controls="controls" autoplay="autoplay">
<source src="masnun.mp3" type="audio/mpeg"/>
</audio><br>
<img src="<?=$icon_url;?>" height="30" ><? echo $apidata; ?>
11년 전
헌이님 감사합니다.
11년 전
네에 ^^
11년 전
해당 코드를 보시면 7번째줄에 도시명을 넣는 곳이 있어요 맞게 넣으시면 됩니다.
도시명은 어케 어는지요. 부산인데...
도시명은 어케 어는지요. 부산인데...
11년 전
$url = "http://api.wunderground.com/api/e9e0b719ce8b9e95/geolookup/conditions/lang:KR/q/Korea/Cheongju.json.json";
Cheongju 수정
Cheongju 수정
Leejs
11년 전
http://api.wunderground.com 이곳에서 도시를 찾아보면 되네요.
11년 전
잘살펴보시면 여러모로 좋은 기능이 많이 있어요
11년 전
집어다가.. 배포해도 되는지 궁금합니다. 헌이님..
주시고자 작정하셨으니.. 그냥 주심 감사하겠습니다..
새해 복 많이 받으세요.. 꾸벅..
좋아유.. 안 찍어서 깜짝 놀랐고.. 후딱 와서 잽싸게 찍고 튑니다. ㅡㅡ
주시고자 작정하셨으니.. 그냥 주심 감사하겠습니다..
새해 복 많이 받으세요.. 꾸벅..
좋아유.. 안 찍어서 깜짝 놀랐고.. 후딱 와서 잽싸게 찍고 튑니다. ㅡㅡ
11년 전
집어다가 배포하시면 아니되옵니다 오직 SIR 그누보드에서 공개하고자 하옵니다.
새해 복많이 받으세요
새해 복많이 받으세요
11년 전
그러네요.. 말씀 알겠습니다.. 감사합니다!!
11년 전
좋아요 꾹~~
10년 전
굉장히 좋네요...^^ 조아요 팍팍..
헌이님 스킨들은 세련되고 깔끔해요...
글구 바램이 있다면..^^; 3개정도 롤링 되면 정말 바랄께 없네요 서울/인천/경기 텍스트만이라도..^^*;
전 건딜 엄두 안나고요.ㅎ
헌이님 스킨들은 세련되고 깔끔해요...
글구 바램이 있다면..^^; 3개정도 롤링 되면 정말 바랄께 없네요 서울/인천/경기 텍스트만이라도..^^*;
전 건딜 엄두 안나고요.ㅎ
10년 전
감사합니다.
zkdlf
9년 전
그런데 방금 다운받아서 사용하고있었는데 갑자기 업어져서 나오지가 안네요...
왜 이러는지 혹시
왜 이러는지 혹시
zkdlf
9년 전
인터넷상에 아무것도 안나오고 온도: 섭씨: 날씨: 이것만 나오는데요...
게시판 목록
그누보드5 스킨
좋은 댓글과 좋아요는 제작자에게 큰힘이 됩니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 164 | 게시판 | 11년 전 | 23193 | ||
| 163 | 회원통합스킨 |
|
11년 전 | 12290 | |
| 162 | 갤러리 | 11년 전 | 42883 | ||
| 161 | 최신글 | 11년 전 | 8076 | ||
| 160 | 최신글 |
|
11년 전 | 8761 | |
| 159 | 게시판 |
|
11년 전 | 14762 | |
| 158 | 게시판 | 11년 전 | 15646 | ||
| 157 | 게시판 | 11년 전 | 16961 | ||
| 156 | 최신글 | 11년 전 | 11716 | ||
| 155 | 게시판 | 11년 전 | 23159 | ||
| 154 | 게시판 |
|
11년 전 | 11329 | |
| 153 | 게시판 | 11년 전 | 15602 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기