package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
func main() {
param := url.Values{
"userName": {"上网帐号"},
"pwd": {"上网密码"},
"opr":{"pwdLogin"},
"rememberPwd": {"0"}}
url := "http://1.1.1.11/ac_portal/login.php"
resp1, err := http.PostForm(url, param)
if err != nil {
fmt.Println(err)
return
}
defer resp1.Body.Close()
buf, err := ioutil.ReadAll(resp1.Body)
fmt.Println(string(buf))
POS: strings.Index = (String (buf), "to false")
IF POS == -1 {
fmt.Println ( "! Internet successful login")
} the else {
fmt.Println ( "Internet login failed! ')
}
}
Deeply convinced automatic Internet authentication (go source)
Guess you like
Origin blog.csdn.net/jiewu001/article/details/84451945
Recommended
Ranking