package main
import (
"crypto/md5"
"encoding/hex"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"strconv"
"time"
)
func main() {
license := "L01234567890123P"
secret := "ABCDEFGHIJKLMNOP"
ts := strconv.FormatInt(time.Now().Unix(), 10)
uri := "https://api-ip.abuyun.com/obtain"
queries := url.Values{}
queries.Set("license", license)
queries.Set("time", ts)
// queries.Set("cnt", "1") // 获取代理数(可选)
signBytes := md5.Sum([]byte(license + ts + secret))
queries.Set("sign", hex.EncodeToString(signBytes[:]))
response, err := http.Get(uri + "?" + queries.Encode())
if err != nil {
log.Fatalln("Failure : ", err)
}
defer response.Body.Close()
respBody, _ := ioutil.ReadAll(response.Body)
fmt.Println("response Body : ", string(respBody))
}