身份證二要素(MD5加密版)接口文檔 點(diǎn)擊下載
身份證核驗(yàn)接入指南 點(diǎn)擊訪問(wèn)
// 接口類(lèi)型:互億無(wú)線(xiàn)實(shí)名認(rèn)證接口
// 賬戶(hù)注冊(cè):https://user.ihuyi.com/register.html
// 注意事項(xiàng):
// DEMO僅作參考
package main
import (
"crypto/md5"
"encoding/hex"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strconv"
"strings"
"time"
)
func GetMd5String(s string) string {
h := md5.New()
h.Write([]byte(s))
return hex.EncodeToString(h.Sum(nil))
}
func main() {
v := url.Values{}
_now := strconv.FormatInt(time.Now().Unix(), 10)
//fmt.Printf(_now)
_account := "APIID"
_password := "APIKEY"
_app := "id2m"http://固定值
_name := "15db57aa314529aaa0fbe95b3e95bd3" //明文:張三
_id_card_no := "9efebb3d7d059bff092842bf31dd2816" //明文:123456789012345678
v.Set("account", _account)
v.Set("password", GetMd5String(_account+_password+_app+_name+_id_card_no+_now))
v.Set("app", _app)
v.Set("name", _name)
v.Set("id_card_no", _id_card_no)
v.Set("time", _now)
//body := ioutil.NopCloser(strings.NewReader(v.Encode())) //把form數(shù)據(jù)編下碼
body := strings.NewReader(v.Encode()) //把form數(shù)據(jù)編下碼
client := &http.Client{}
req, _ := http.NewRequest("POST", "https://api.ihuyi.com/idcard/Submit.json", body)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded;")
//fmt.Printf("%+v\n", req) //看下發(fā)送的結(jié)構(gòu)
resp, err := client.Do(req) //發(fā)送
defer resp.Body.Close() //一定要關(guān)閉resp.Body
data, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(data), err)
}
驗(yàn)證碼已發(fā)送到您的手機(jī),請(qǐng)查收!
輸入驗(yàn)證碼后,點(diǎn)擊“開(kāi)通體驗(yàn)賬戶(hù)”按鈕可立即開(kāi)通體驗(yàn)賬戶(hù)。