PracticeDev/study_go/whois/get.go

27 lines
549 B
Go

package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://whoisapi.p.rapidapi.com/whoisserver/WhoisService?userName=songtianlun&password=sotilu!999&domainname=frytea.com"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-rapidapi-key", "a89129e232msh65226cdbacef7dap19aee0jsn07aa234be71d")
req.Header.Add("x-rapidapi-host", "whoisapi.p.rapidapi.com")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}