杰网资源 Design By www.escxy.com

使用标准库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请求的资料请关注其它相关文章!

标签:
Golang,发送GET请求,golang,http

杰网资源 Design By www.escxy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
杰网资源 Design By www.escxy.com