[Go] Golang发送http GET请求
使用标准库http来实现
package tools import ( "io/ioutil" "net/http" ) func Get(url string)string{ res, err :=http.Get(url) if err != nil { return "" } robots, err := ioutil.ReadAll(res.Body) res.Body.Close() if err != nil { return "" } return string(robots) }
- 上一篇 »python+requests发送get请求
- 下一篇 »java 发送 http 请求