The go language implements a simple http client grab remote url method

  • 2020-05-26 09:19:12
  • OfStack

This article illustrates a simple http client grab remote url method in the go language. Share with you for your reference. The specific implementation method is as follows:

package main
import (
 "fmt"
 "log"
 "net/http"
 "net/url"
 "io/ioutil"
)
func main() {
resp, err := http.Get("http://www.google.co.jp")
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
}

I hope this article has been helpful to your programming of Go language.


Related articles: