废话少说,直接奉上代码:

package main

import (

"fmt"

"time"

"io/ioutil"

"net/http"

"regexp"

"strings"

)

func main() {

ip_pool := []string{

"172.16.1.128",

"172.16.1.129",

"172.16.1.131",

"172.16.1.132",

"172.16.1.133",

"172.16.1.134",

"172.16.1.135",

"172.16.1.136",

"172.16.1.137",

"172.16.1.138",

"172.16.1.190",

}

for {

for i:=0;i

url := "http://"+ip_pool[i]+":10022"

//fmt.Println("-----------------",ip_pool[i],"---------")

get_url(url)

time.Sleep(1*time.Millisecond)

}

//time.Sleep(time.Second * 60)

}

}

func get_url(url string){

fmt.Println("----------",url,"----------------")

resp, err := http.Get(url)

if err != nil {

fmt.Println("http get error.")

}

defer resp.Body.Close()

body, err := ioutil.ReadAll(resp.Body)

if err != nil {

fmt.Println("http read error")

}

src := string(body)

//将HTML标签全转换成小写

re, _ := regexp.Compile("\\")

src = re.ReplaceAllStringFunc(src, strings.ToLower)

//  提取table 标签

re,_ = regexp.Compile("\\

src = re.ReplaceAllString(src, "

re,_ = regexp.Compile("

[\\S\\s]+?\\