使用标准库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) }
以上就是Golang发送http GET请求的示例代码的详细内容,更多关于Golang发送http GET请求的资料请关注自学编程网其它相关文章!
- 本文固定链接: https://zxbcw.cn/post/201493/
- 转载请注明:必须在正文中标注并保留原文链接
- QQ群: PHP高手阵营官方总群(344148542)
- QQ群: Yii2.0开发(304864863)