func http_get(url string) (res []byte) { req, _ := http.NewRequest("GET", url, nil) if SID != "" { req.AddCookie(&http.Cookie{Name: "sid", Value: SID}) } r, er := new(http.Client).Do(req) if er != nil { println(url, er.Error()) os.Exit(1) } if SID == "" { for i := range r.Cookies() { if r.Cookies()[i].Name == "sid" { SID = r.Cookies()[i].Value //fmt.Println("sid", SID) } } } if r.StatusCode == 200 { defer r.Body.Close() res, _ = ioutil.ReadAll(r.Body) } else { println(url, "http.Get returned code", r.StatusCode) os.Exit(1) } return }