用golang复现以下python代码g_url = httpliteweixinoacomcgi-binmmwxalitedevwebnodelogicsvr-bindevtoolslaunchAppg_epsmallmicrotest_host = httpapimtwoacomepsmallmicrotest
golang代码如下:
package main
import (
"fmt"
"net/http"
"net/url"
)
const (
g_url = "http://lite.weixin.oa.com/cgi-bin/mmwxalitedevwebnodelogicsvr-bin/devtools/launchApp"
g_epsmallmicrotest_host = "http://api.mt.woa.com/epsmallmicrotest"
)
func main() {
// 构造请求参数
params := url.Values{}
params.Set("appid", "wx123456")
params.Set("path", "pages/index")
params.Set("env", "test")
params.Set("version_type", "develop")
params.Set("token", "token123")
// 发送POST请求
resp, err := http.PostForm(g_url, params)
if err != nil {
fmt.Println(err)
return
}
defer resp.Body.Close()
// 输出响应结果
fmt.Println(resp.Status)
fmt.Println(resp.Header)
fmt.Println(resp.Body)
}
``
原文地址: http://www.cveoy.top/t/topic/fuWO 著作权归作者所有。请勿转载和采集!