您的位置:首页技术文章

Golang发送http GET请求的示例代码

【字号: 日期:2023-08-23 16:53:36浏览:42作者:馨心

使用标准库http来实现

package toolsimport ( '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请求的资料请关注优爱好网其它相关文章!

标签: Golang
相关文章: