goland 提交表单

180it 2020-10-26 PM 71℃ 0条
package main

import (
    "net/http"
    "net/url"
    "fmt"
    "io/ioutil"
)


func main() {

    //?mod=forumdisplay&fid=42
    params:=url.Values{  "action":{"add"},  "name":{"42"},  "tel":{"13903400000"},  "text":{"不详"},  "classid":{"39"}}

    //r,_:=http.Get("http://dashanxue.com/forum.php?mod=forumdisplay&fid=42")
    //Get for get,PostForm for post with params
    r,_:=http.PostForm("http://form4.xxxx.com/getdata.php",params)

    //defer r.Body.Close()

    b,_:=ioutil.ReadAll(r.Body)
    r.Body.Close()
    fmt.Printf(string(b))


}
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

goland 提交表单