[Go] Golang发送http GET请求

前端之家收集整理的这篇文章主要介绍了[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,1)"> IoUtil.ReadAll(res.Body)
    res.Body.Close()
    
    }
    return (robots)
}

 

猜你在找的Go相关文章