https://developers.skplanetx.com/apidoc/kor/t-map/course-guide/geojson/
tmap에서 제공하는 경로안내 api인데요
머리가 나빠서 그런가 한글로 써놨는데도 이해가 가질 않아서요
https://apis.skplanetx.com/tmap/routes?version=1&callback={callback}
콜백인자를 던지라는데 밑의 셈플을 넣어봐도 그렇고 결과값을 리턴하질 않네요
사용법 아시는분은 듣는녀석이 무식하니 좀 자세하게 친절하게 답변좀 부탁드립니다. ㅡ,.ㅜ
좋은하루 되세요
답변 2개 / 댓글 8개
채택된 답변
+20 포인트
2016-09-30 (금) 10:56:23
Copy
<?php# CURL 통신if(!function_exists('SendCurl')) { function TmapCurl($key, $url, $data='') { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'appKey: '.$key)); if($data) curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $return = curl_exec($ch); curl_close($ch); return $return; }} $Return = TmapCurl('API KEY ', 'https://apis.skplanetx.com/tmap/routes?version=1&callback=', 'endX=14363856.085492350&endY=4178405.946508492&startX=14135591.321772&startY=4518111.822511&reqCoordType=EPSG3857&resCoordType=WGS84GEO&tollgateFareOption=1&roadType=32&directionOption=0&endRpFlag=16&endPoiId=67516&gpsTime=10000&angle=90&speed=60&uncetaintyP=3&uncetaintyA=3&uncetaintyAP=12&camOption=0&carType=0&startName=%EB%A1%AF%EB%8D%B0%EB%B0%B1%ED%99%94%EC%A0%90&endName=%EB%B6%80%EC%82%B0%EC%8B%9C%EC%A4%91%EA%B5%AC%EC%B2%AD&searchOption=0');print_r(json_decode($Return, true));
급하게 맹글어 봤습니다. ㅋㅋ
답변에 대한 댓글 5개
terrorboy
2016-09-30 (금) 11:04:17
function_exists('SendCurl')
를
function_exists('TmapCurl')
로 변경 하시구용
를
function_exists('TmapCurl')
로 변경 하시구용
2016-09-30 (금) 10:22:49
Request Payload
부분위 항목을 넣으면될것 같습니다.
부분위 항목을 넣으면될것 같습니다.
POST /tmap/routes HTTP/1.1
Host: apis.skplanetx.com
appKey: 1234-5678-9012-3456
Accept-Language: ko
Content-Type: application/x-www-form-urlencoded
endX=14363856.085492350&endY=4178405.946508492&startX=14135591.321772&startY=4518111.822511&reqCoordType=EPSG3857&resCoordType=WGS84GEO&tollgateFareOption=1&roadType=32&directionOption=0&endRpFlag=16&endPoiId=67516&gpsTime=10000&angle=90&speed=60&uncetaintyP=3&uncetaintyA=3&uncetaintyAP=12&camOption=0&carType=0&startName=%EB%A1%AF%EB%8D%B0%EB%B0%B1%ED%99%94%EC%A0%90&endName=%EB%B6%80%EC%82%B0%EC%8B%9C%EC%A4%91%EA%B5%AC%EC%B2%AD&searchOption=0
답변에 대한 댓글 3개
2016-09-30 (금) 10:35:27
그러게요 이런저런 인자 다 뜯어붙여봤는데 리턴값이 나오질 않아서요 ㅡ.ㅜ
쪽지로 api키 드려볼까요? ㅡ.ㅜ
쪽지로 api키 드려볼까요? ㅡ.ㅜ
답변을 작성하려면 로그인이 필요합니다.