您最多能選擇 25 個主題
主題必須以字母或數字為開頭,可包含連接號「-」且最長為 35 個字元。
31 行
660 B
31 行
660 B
3 年前
|
package utils
|
||
|
|
||
|
import (
|
||
|
"io/ioutil"
|
||
|
"net/http"
|
||
|
"strconv"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
//const baseUrl = "http://localhost/blog/"
|
||
|
const baseUrl = "https://www.aiprose.com/blog/"
|
||
|
|
||
|
func PostDataZZ(id int64) {
|
||
|
//if len(ids) < 1 {
|
||
|
// return
|
||
|
//}
|
||
|
//dataStr := ""
|
||
|
//for id := range ids{
|
||
|
// dataStr = dataStr + baseUrl + string(id) + "\n"
|
||
|
//}
|
||
|
dataStr := baseUrl + strconv.FormatInt(id, 10)
|
||
|
url := "http://data.zz.baidu.com/urls?site=www.aiprose.com&token=lO2wHMVqVq8SC9Ag"
|
||
|
res, err := http.Post(url, "text/plain", strings.NewReader(dataStr))
|
||
|
if err != nil {
|
||
|
println(err)
|
||
|
}
|
||
|
defer res.Body.Close()
|
||
|
content, err := ioutil.ReadAll(res.Body)
|
||
|
println(string(content))
|
||
|
}
|