날씨 정보를 출력하려고 하는데 예전처럼 잘 안되네요.. > 그누3질답

그누3질답

날씨 정보를 출력하려고 하는데 예전처럼 잘 안되네요.. 정보

그누보드 날씨 정보를 출력하려고 하는데 예전처럼 잘 안되네요..

본문

처음에는

www.kma.go.kr 기상청에서 제공하는 실시간 날씨 정보를 weather.php라는 파일안에 아래와 같이 불러왔는데 이것도 안되네요.

<?
include "http://www.kma.go.kr/weather/current/sfc_now.jsp";
?>

다음과 같은 오류가 발생했는데 무엇인지??? ㅡ.ㅡ;

Warning: main() [function.main]: URL file-access is disabled in the server configuration in /home/주소/weather.php on line 155

Warning: main(http://www.kma.go.kr/weather/current/sfc_now.jsp) [function.main]: failed to create stream: no suitable wrapper could be found in /home/주소/weather.php on line 155

Warning: main() [function.main]: Failed opening 'http://www.kma.go.kr/weather/current/sfc_now.jsp' for inclusion (include_path='.:/usr/local/lib/php') in /home/주소/weather.php on line 155

*********************************************************************************

두번째는

weather.php 파일안에 아래와 같은 코드를 넣었는데 역시 위와 같은 오류가 발생하드라구요
(참고로 아래 코드는 좋은신분이 그누보드에서 알려주신 것임.)
<?
$url = "http://weather.hanmir.com/weather_area.php?sRegion_id=11B00000&sSubCity=11B10101"; //서울 필요한 정보가있는url을 입력하세요
$url2 = "http://weather.hanmir.com/weather_area.php?sRegion_id=11C20000&sSubCity=11C20401"; //대전
$line_array = file($url);
$line_array2 = file($url2);
$line_string = implode("",$line_array);
$line_string2 = implode("",$line_array2);
eregi("<!-- 선택도시 날씨 시작 -->(.*)<!-- 선택도시 날씨 끝 -->",$line_string,$mydata); //  소스 살펴보시고 원하는 부분 첨과 긑부분을 인식시켜주세요 ^^
eregi("<!-- 선택도시 날씨 시작 -->(.*)<!-- 선택도시 날씨 끝 -->",$line_string2,$mydata2);
$weather = ereg_replace("images/","http://weather.hanmir.com/images/icons/", $mydata[0]); // 이미지 경로를 바꿔준다
$weather2 = ereg_replace("images/","http://weather.hanmir.com/images/icons/", $mydata2[0]);
echo"
<body style= margin:0; padding:0; marginwidth=0 marginheight=0>

<table width='585' height='100%' bgcolor='#EDECE5' cellpadding='0' cellspacing='0'> 
<tr>
        <td>$weather</td>
</tr>
</table>
<table width='585' height='100%' bgcolor='#EDECE5' cellpadding='0' cellspacing='0'>
<tr>
        <td>$weather2</td>
</tr>
</table>
";
/*
ereg_replace
기    능 문자열에서 특정 패턴을 찾아서 주어진 패턴으로 바꾼다.

사 용 법 string ereg_replace(string pattern, string replace, string string);

설    명 주어진 문자열 string에서 pattern을 찾아서 replace로 바꾼다.

$a = "abcde";
$b = ereg_replace("ab", "xy", $a);
// $b = "xycde";
*/

?>
 
********************************************************************************

제가 미숙한 관계로 모르겠네요...
  • 복사

댓글 전체

첫번째는 doctype와 남겨주신 소스를 넣고 해보니 잘 됩니다.
일부 표현되지 않는 이미지가 있어서 그렇지요 ....

두번째는 어떤 소스인지 잘은 모르겠습니다. 팁엔테크에 기상청
관련 불러오는 소스는 해당 파일에 경로만 맞게 수정해 주면 작동이
잘 되더군요.

위 자료를 사용해 보시기를 권해 드립니다.

미리보기 > http://www.slgi.co.kr/gnu3/?doc=weather.php
© SIRSOFT
현재 페이지 제일 처음으로