Browse Source

fix:请求百度bug

master
燕鹏 2 years ago
parent
commit
f47e18c401
  1. 12
      utils/data_zz.go

12
utils/data_zz.go

@ -7,17 +7,9 @@ import (
"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))
@ -26,5 +18,7 @@ func PostDataZZ(id int64) {
}
defer res.Body.Close()
content, err := ioutil.ReadAll(res.Body)
println(string(content))
if err != nil {
println(string(content))
}
}

Loading…
Cancel
Save