1 package main
2
3 import(
4 "fmt"
5 "net/http"
6 "io/ioutil"
7 )
8 func main(){
9
10 response,_:=http.Get("www.//127.0.0.1.com")
11 defer response.Body.Close()
12 body,_:=ioutil.ReadAll(response.Body)
13 fmt.Println(string(body))
14
15 if response.StatusCode == 200 {
16 fmt.Println("ok")
17
18 }else{
19 fmt.Println("error")
20
21 }
22 }
有疑问加站长微信联系(非本文作者)