package main
import (
"fmt"
"github.com/robfig/cron"
"io/ioutil"
"net/http"
)
func main() {
c := cron.New()
//c.AddFunc("*/10 * * * * ?", func() { fmt.Println("this is message") })
c.AddFunc("*/20 * * * * ?", getRequest)
c.Start()
select {
}
}
func getRequest() {
resp, err := http.Get("https://xxxxxxxxxx")
if err != nil {
fmt.Println("http.Get err=",err)
return
}
bytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("ioutil.ReadAll err=",err)
return
}
fmt.Println(string(bytes))
}
02-17
3692
05-16
462