-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmap.php
More file actions
69 lines (57 loc) · 1.9 KB
/
map.php
File metadata and controls
69 lines (57 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta charset='utf-8'>
<link rel="stylesheet" href="./map.css">
<script type="text/javascript" src="https://openapi.map.naver.com/openapi/v3/maps.js?clientId=jZawGNWf455qVfd4tYvK"></script>
</head>
<body>
<?php
/* $client_id = "jZawGNWf455qVfd4tYvK";
$client_secret = "mJCq1wh55u";
$encText = urlencode($_GET['addr']);
$url = "https://openapi.naver.com/v1/map/geocode?query=".$encText;
$is_post = false;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $is_post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = array();
$headers[] = "X-Naver-Client-Id: ".$client_id;
$headers[] = "X-Naver-Client-Secret: ".$client_secret;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec ($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// echo "status code: ".$status_code."";
curl_close($ch);
// echo $response;
$result = json_decode($response, true);
// print_r($result);
$x = $result[result][items][0][point][x];
$y = $result[result][items][0][point][y];
*/
?>
<img width="150px" height="50px"src="./logo.png"></img>
<br/><br/>
<div class="지도 표시" id="map" style="width:100%;height:400px;"></div>
<script>
var map = new naver.maps.Map('map', {
center: new naver.maps.LatLng(<?php echo $_GET['y'];?>, <?php echo $_GET['x'];?>),
zoom: 10
});
var marker = new naver.maps.Marker({
position: new naver.maps.LatLng(<?php echo $_GET['y'];?>, <?php echo $_GET['x'];?>),
map: map
});
</script>
</div>
<div class="content">
<p>기관이름: <?php echo $_GET['name'];?></p>
<p>기관주소: <?php echo $_GET['addr'];?></p>
<p>전화번호: <?php echo $_GET['tel'];?></p>
</div>
<button onclick="javascript:history.back()">뒤로가기</button>
</body>
</html>