您是否正受到短信签名报备的困扰?互亿无线解决方案让您最快15分钟内恢复信息传递,马上 注册体验
所有文档
运营商信息核验
文档中心 > 运营商信息核验 > 空号检测

空号检测

Go对接空号检测提交接口接口DEMO示例
本文为您提供了Go语言版本的空号检测提交接口接口对接DEMO示例

//测试: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))
}

5分钟快速自助开通免费体验账户

在线咨询
电话咨询

服务热线:

4008 808 898

服务热线(工作时间):

4008 808 898

业务咨询(非工作时间):

售后咨询(非工作时间):