메뉴 건너뛰기

프로그램언어

조회 수 496 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

public function index()

{

$url = $this->get_uriPath();

$google = json_decode($this->get_map( str_replace("?", "", str_replace("\r\n", "", $url[1]) )));

$gpoint = array();

foreach($google as $k) {

$gpoint['x'] = $k->items[0]->point->x;

$gpoint['y'] = $k->items[0]->point->y;

}

 

echo json_encode($gpoint);

 

}

 

function get_map($addr)

{

$ch = curl_init();

$address = $addr;

 

$encoding="utf-8"; //출력 결과 인코딩 값으로 'utf-8', 'euc-kr' 가능

$coord="latlng"; //출력 좌표 체계 값으로 latlng(위경도), tm128(카텍) 가능

$output="json" ;//json,xml

 

$qry_str = "?encoding=".$encoding."&coord=".$coord."&output=".$output."&query=".$address;

$headers = array(

"X-Naver-Client-Id: 네이버발급", //Client ID            

"X-Naver-Client-Secret: 네이버발급" //Client Secret

);

 

$url="https://openapi.naver.com/v1/map/geocode";

curl_setopt($ch, CURLOPT_URL, $url.$qry_str);

 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);                

$res = curl_exec($ch);

curl_close($ch);

 

return $res;

}

 

function get_uriParse()

{

$url = $_SERVER['SERVER_NAME'];

$parse_url = explode(".", $url);

return $parse_url[0];

}

 

function get_uriPath() {

$querystring = $_SERVER['REQUEST_URI'];

return $parse_query = explode("/?", $querystring);

}


List of Articles
번호 제목 날짜 조회 수
80 stripcslashes — addcslashes()로 인용한 문자열을 되돌림 2016.12.23 20458
79 quotemeta 모든 메타 문자앞에 역슬래쉬를 붙인 문자열을 반환 2016.12.23 20461
78 stripslashes — 따옴표 처리한 문자열을 풉니다 2016.12.23 20486
77 문자열 치환하기 2015.04.14 20493
76 [PHP] 한글명 파일 다운로드받기 2014.03.26 20551
75 HTTP Protocol의 data method - GET / POST 2016.04.22 20637
74 PHP 소스 : 이미지 리사이즈, 섬네일 2014.03.26 20707
73 템플릿 관련 정보 2016.08.22 20732
72 array_slice 배열의 일부를 추출 2016.12.23 20775
71 검색어 처리 루틴 2015.04.14 20778
70 preg_match (정규표현식 매치를 수행합니다) 2016.12.23 20854
69 PHP error 메시지 출력 file 2015.04.14 20924
68 PHP switch 문 file 2015.04.14 20993
67 Ajax로 구연한 실시간 서버시간출력 file 2017.03.06 21032
66 RSSReader Class 제작 및 Reader 만들기 file 2016.08.22 21042
65 FPDF - PHP로 PDF 만들기 2014.02.27 21086
64 PHP continue 문 file 2015.04.14 21097
63 체크박스, post 로 넘기고 받아서 다시 체크하기, checkbox 2017.03.07 21134
62 POST값 통째로 인코딩하기 1 2015.04.06 21175
61 DB 내용을 화면에 출력(이중 for 문) 2015.04.14 21246
Board Pagination Prev 1 ... 8 9 10 11 12 13 14 15 16 17 Next
/ 17

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved