openweathermap 작동이안되는데 이렇게하면 된다는데 안되네요 채택완료
zkdlf
8년 전
조회 3,374
날씨 소스를 이렇게 했는데 안되네요? 그리고 API키를 안넣어도 작동하나요?
Warning: include_once() [http://www.timeplace.co.kr/function.include-once">function.include-once]: URL file-access is disabled in the server configuration in /home/tnhands/public_html/board/ds/ds.php on line 4
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<?php
include_once ("http://api.openweathermap.org/data/2.5/weather?q=Seoul,uk">http://api.openweathermap.org/data/2.5/weather?q=Seoul,uk");
?>
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
8년 전
제가 작년 말쯤 작성해 둔 소스 올려 두었으니
다운 받아 참조하시죠.
http://sir.kr/g5_plugin/2118" target="_self">http://sir.kr/g5_plugin/2118
로그인 후 평가할 수 있습니다
답변에 대한 댓글 2개
z
zkdlf
8년 전
감사합니다 아직 해보진 않았지만 좋은 자료 감사합니다
z
zkdlf
8년 전
내일 날씨를 넣고 습도도 넣고싶은데 그럴려면 어떻게해야하나요?
$w_condition_json = file_get_contents("./board/weather/icons.json");
$w_condition = json_decode($w_condition_json,true);
$cur_weather = strtolower($w_result->weather[0]->main);//오늘 날씨 소문자로...
$cur_temp_min = sprintf("%2.1f",$w_result->main->temp_min - 273.15);//오늘 최저 온도
$cur_temp_max = sprintf("%2.1f",$w_result->main->temp_max - 273.15);//오늘 최고 온도
$cur_temp = sprintf("%2.1f",$w_result->main->temp - 273.15);//오늘 현재온도
$cur_icon = $w_result->weather[0]->icon;//날씨아이콘이름
$cur_icon_id = $w_result->weather[0]->id;//날씨아이콘 id(숫자)
$cur_weather_han = $w_condition[$cur_icon_id]['han'];//날씨상태 한글
//시간대별로 아이콘폰트를 다르게 설정
$ymd = date("Y-m-d");
$cur_time = time();
$date1 = strtotime($ymd." 09:00:00");
$date2 = strtotime($ymd." 16:00:00");
$date3 = strtotime($ymd." 18:00:00");
$date5 = strtotime($ymd." 23:59:59");
$date6 = strtotime($ymd." 00:01:01");
$date7 = strtotime($ymd." 06:00:00");
if($cur_time > $date1 && $cur_time < $date2) $owm_icon = "wi-owm-day-".$cur_icon_id; //낮
elseif($cur_time > $date3 && $cur_time < $date5) $owm_icon = "wi-owm-night-".$cur_icon_id; //밤
elseif($cur_time > $date6 && $cur_time < $date7) $owm_icon = "wi-owm-night-".$cur_icon_id; //밤
else $owm_icon = "wi-owm-".$cur_icon_id; //아침과 해거름
$w_condition_json = file_get_contents("./board/weather/icons.json");
$w_condition = json_decode($w_condition_json,true);
$cur_weather = strtolower($w_result->weather[0]->main);//오늘 날씨 소문자로...
$cur_temp_min = sprintf("%2.1f",$w_result->main->temp_min - 273.15);//오늘 최저 온도
$cur_temp_max = sprintf("%2.1f",$w_result->main->temp_max - 273.15);//오늘 최고 온도
$cur_temp = sprintf("%2.1f",$w_result->main->temp - 273.15);//오늘 현재온도
$cur_icon = $w_result->weather[0]->icon;//날씨아이콘이름
$cur_icon_id = $w_result->weather[0]->id;//날씨아이콘 id(숫자)
$cur_weather_han = $w_condition[$cur_icon_id]['han'];//날씨상태 한글
//시간대별로 아이콘폰트를 다르게 설정
$ymd = date("Y-m-d");
$cur_time = time();
$date1 = strtotime($ymd." 09:00:00");
$date2 = strtotime($ymd." 16:00:00");
$date3 = strtotime($ymd." 18:00:00");
$date5 = strtotime($ymd." 23:59:59");
$date6 = strtotime($ymd." 00:01:01");
$date7 = strtotime($ymd." 06:00:00");
if($cur_time > $date1 && $cur_time < $date2) $owm_icon = "wi-owm-day-".$cur_icon_id; //낮
elseif($cur_time > $date3 && $cur_time < $date5) $owm_icon = "wi-owm-night-".$cur_icon_id; //밤
elseif($cur_time > $date6 && $cur_time < $date7) $owm_icon = "wi-owm-night-".$cur_icon_id; //밤
else $owm_icon = "wi-owm-".$cur_icon_id; //아침과 해거름
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인