|
本帖最后由 waini1110 于 2018-6-1 16:21 编辑
五分钟写了一个,没考虑什么优化。随便吧。而且访问空间也是固定的。也没有定时任务,有时间再加吧。
替换用户名和密码,没做成配置文件。 编译的话,go build 就行了
[ol]package mainimport ( "fmt" "net/http" "net/http/cookiejar" "strings" "io/ioutil" "strconv")func main() { client := &http.Client{} jar, err := cookiejar.New(nil) if err != nil { fmt.Println(err) } client.Jar = jar req,err := http.NewRequest("POST","https://www.hs2v.com/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=1",strings.NewReader("username=username&password=password")) if err != nil { fmt.Println(err) } req.Header.Set("Referer","https://www.hs2v.com/forum.php") req.Header.Set("Accept-Language","zh-CN,zh;q=0.9") req.Header.Set("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3391.0 Safari/537.36") req.Header.Set("Host","www.hs2v.com") req.Header.Set("Content-Type","application/x-www-form-urlencoded") resp, _ := client.Do(req) defer resp.Body.Close() a,_:=strconv.Atoi("9000") for i:=1;i复制代码 |
|