25 lines
378 B
Go
25 lines
378 B
Go
package pixelapi
|
|
|
|
import "net/http"
|
|
import "io/ioutil"
|
|
|
|
func get(url string) (string, error) {
|
|
req, err := http.NewRequest("GET", url, nil)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
client := &http.Client{}
|
|
|
|
resp, err := client.Do(req)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
defer resp.Body.Close()
|
|
|
|
bodyBytes, err := ioutil.ReadAll(resp.Body)
|
|
|
|
return string(bodyBytes), err
|
|
}
|