busterm_control.js 759 Bytes
var request = require("sync-request");
var station_servicekey = "8X6B2qUgjGCX4APyGjxTH13yYqgEFZ2jaGus469okviEDTS3TmlEFg6uyfW9I45HjBZQuzfXXHTDpr1bPfp3rA%3D%3D";
var keyword_bus_number = "1112";

var obj = ["1112","7000","9","5100","1560"];
var route_station_url = "http://openapi.gbis.go.kr/ws/rest/busrouteservice";
var busarrival_station_url = "http://openapi.gbis.go.kr/ws/rest/busarrivalservice";
var serviceKey_string = "?serviceKey="+station_servicekey+"&";

for(var i = 0; i<obj.length; i++) {
   var keyword_parameter = "keyword="+obj[i];
   console.log(keyword_parameter);
   var uris = route_station_url+serviceKey_string+keyword_parameter;
   var res = request('GET', uris);
   var gotData = res.getBody().toString();
   console.log(gotData); 
   
}