本文为您提供了Go语言版本的提交号码标记查询(平台版)接口对接DEMO示例
//测试:go run ./test.go
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
const strUrl = "https://api.ihuyi.com/info_service/numbermarkplatform/Submit.json"
func main() {
v := url.Values{}
v.Set("account", "xxxxxxxx") //APIID(用户中心【信息服务】-【号码标记查询(平台版)】-【产品总览】 查看)
v.Set("password", "xxxxxxxxx") //1、APIKEY(用户中心【信息服务】-【号码标记查询(平台版)】-【产品总览】 查看)
2、动态密码(生成动态密码方式请看该文档末尾的说明)
v.Set("content", "136xxxxxxxx") //号码,支持手机号、电话号码、400号码、95/96号码;手机号为中国大陆地区11位数字,电话号码为区号+号码。
程序不校验号码的正确性,请查询前请确保号码真实有效。号码标记查询服务按提交成功计费,提交失败自动退费。
v.Set("time", "1623643787") //Unix时间戳(10位整型数字,当使用动态密码方式时为必填)
body := strings.NewReader(v.Encode()) //把form数据编码
client := &http.Client{}
req, _ := http.NewRequest("POST", strUrl, body)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
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))
}
在线咨询
150,000家
企业客户
21年
行业经验
2V1
2对1客户支持