使用标准库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发送http GET请求的示例代码的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did165773