//测试:go run ./test.go
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
const strUrl = "https://api.ihuyi.com/empty-number/submit"
func main() {
params := map[string]interface{}{
"mobiles": []string{"18800000000", "18800000002"}, //手机号数组(最多10个)
}
//将params转成json字符串
jsonBody, err := json.Marshal(params)
if err != nil {
fmt.Println("JSON转换错误:", err)
return
}
body := string(jsonBody)
client := &http.Client{}
req, _ := http.NewRequest("POST", strUrl, strings.NewReader(body))
req.Header.Set("Content-Type", "application/json; charset=utf-8") //form表单提交
req.Header.Set("Date", "Tue, 26 Aug 2025 07:14:23 GMT; charset=utf-8") // 请替换为当前的GMT时间,可参考:https://gitee.com/shsurlink/api-demo/blob/master/hmac-auth/go/main.go
req.Header.Set("Authorization", "Signature xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; charset=utf-8") //请替换为您的鉴权签名,可参考:https://gitee.com/shsurlink/api-demo/blob/master/hmac-auth/go/main.go
resp, err := client.Do(req) //发送
if err != nil {
fmt.Println(err)
}
defer resp.Body.Close() //一定要关闭resp.Body
res, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(res))
}
国内专业互联网团队
21年行业经验
7x24小时售后支持
丰富的行业经验
Copyright © 2004-2025 上海思锐信息技术有限公司 All rights reserved. 沪ICP备07035915号-15 电信增值业务许可证:B2-20160082
服务热线:
4008 808 898
服务热线(工作时间):
4008 808 898
业务咨询(非工作时间):
售后咨询(非工作时间):