개가죽님 성공했습니다! 정보
개가죽님 성공했습니다!본문
fsockopen으로는 아무리 해도 보안문제로 되지 않구요, cURL을 써서 해결했습니다.
<?
// 지도의 폭
$map_width = 700;
// 지도의 높이
$map_height = 630;
// 지도의 축적 1~11 사이의 자연수. 1에 가까울 수록 지도가 확대
$map_zoom = 2;
// 네이버 지도api 키값
$map_key = "key=여기에 네이버 지도 키를 적어주세요"; // 임의로 없앴습니다.
// 쿼리 돌릴 주소
$map_query=str_replace(" ","%20",$view[wr_4]); // 4번 여유 필드에 저장 되어 있는 주소의 공백을 제거하여 변수에 저장
// euc-kr로 변환
if ($g4['charset'] == 'utf-8') {
$map_cquery =iconv("utf-8","euc-kr","$map_query");
}
// 여기부터 주소 검색 xml 파싱
$pquery = $map_key. "&query=". $map_query;
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL,"http://maps.naver.com/api/geocode.php?$pquery");
curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($curl, CURLOPT_SSLVERSION,3);
curl_setopt ($curl, CURLOPT_HEADER, 0);
curl_setopt ($curl, CURLOPT_POST, false);
curl_setopt ($curl, CURLOPT_TIMEOUT, 15);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);
// 여기부터 좌표값 변수에 등록
if (preg_match("/(\d+)<\/x>\s*(\d+)<\/y>/i", $result, $match)) {
$map_x_point = $match[1];
$map_y_point = $match[2];
}
?>
<!-- 네이버 지도 키 값 임의로 없앴습니다.-->
<SCRIPT LANGUAGE="JavaScript" src="http://maps.naver.com/js/naverMap.naver?key=여기에 네이버 지도 키를 적어주세요"></SCRIPT>
<!-- 네이버 지도 키 값 끝 -->
<table width="500" cellpadding="0" cellspacing="3" bgcolor="f4f4f4" >
<tr>
<td bgcolor="ffffff">
<table width="100%" cellpadding="0" cellspacing="1" bgcolor="cccccc" >
<tr>
<td height="1" bgcolor="61AAC4">
</td>
</tr>
<tr>
<td bgcolor="ffffff">
<table width="100%" cellpadding="3" cellspacing="1" bgcolor="eeeeee" >
<tr bgcolor="ffffff">
<td>
<!-- 지도 출력 -->
<div id='mapContainer'></div>
<!-- 지도 출력 끝 -->
</tr>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<SCRIPT LANGUAGE="JavaScript">
<!--
var x_point = <? echo $map_x_point; ?>;
var y_point = <? echo $map_y_point; ?>;
var icon = new NIcon("<?=$board_skin_path?>/img/point.gif", new NSize(13,35));
var loc_Point = new NPoint(x_point,y_point); // 포인트 표시
var map_mark = new NMark(loc_Point, icon ); // 지도에 아이콘 표시
var mapObj = new NMap(document.getElementById('mapContainer'),<? echo $map_width; ?>,<? echo $map_height; ?>); // 지도창
var infowin = new NInfoWindow();
var zoom = new NZoomControl();
var zoomlevel = <? echo $map_zoom; ?>
mapObj.addOverlay(map_mark); // 지도에 마크표시
mapObj.setCenterAndZoom(loc_Point,zoomlevel); // 지도 중앙
mapObj.addOverlay(infowin);
zoom.setAlign("left"); // 줌 조절 버튼 왼쪽에 위치
zoom.setValign("bottom"); // 줌 조절 버튼 아래에 위치
// mapObj.enableWheelZoom(); 지도 안에서 휠로 줌 조절 가능하게 하려면 주석을 풀어주세요
mapObj.addControl(zoom);
//-->
</SCRIPT>
1
댓글 3개


나중에 연동시켜서 스킨 다시 올려야겠네요 정말 고맙습니다.