Created
March 13, 2017 23:23
-
-
Save carlqt/c86bcf7b48dd0d8f6fbe49f3062165b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"os" | |
) | |
func main() { | |
busKey := os.Getenv("ACCOUNT_KEY") | |
// googleServerKey := os.Getenv("GOOGLE_SERVER_KEY") | |
ltaUserKey := "3f8e685f-1505-4fe1-9b70-f08f8e8f3cbe" | |
url := "http://datamall2.mytransport.sg/ltaodataservice/BusStops?$skip=13" | |
client := &http.Client{} | |
req, _ := http.NewRequest("GET", url, nil) | |
req.Header.Set("UniqueUserID", ltaUserKey) | |
req.Header.Set("AccountKey", busKey) | |
req.Header.Set("Accept", "application/json") | |
resp, err := client.Do(req) | |
if err != nil { | |
panic(err) | |
} | |
defer resp.Body.Close() | |
body, _ := ioutil.ReadAll(resp.Body) | |
fmt.Println("response Body:", string(body)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment