go https client get
go 语言如何使用https client, 其实还是很简单的,首先要 import “crypto/tls” 然后使用TLSClientConfig
show me the codepackage main
import (
"crypto/tls"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: tr}
resp, err := client.Get("https://blog.csdn.net/qianbo042311/article/details/118654609")
if err != nil {
fmt.Println("error:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}