互亿无线 · 文档中心

企业工商四要素 - 代码示例


Go对接企业工商信息核验接口DEMO示例
本文为您提供了Go语言版本的企业工商四要素核验对接DEMO示例

企业工商信息四要素接口文档 点击下载

企业工商信息四要素接入指南 点击访问


// 接口类型:互亿无线实名认证接口
// 账户注册:https://user.ihuyi.com/register.html
// 注意事项:
// 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 := "ent4"//固定值
	_name := "张三"
	_id_card_no := "123456789012345678"
	_ent_name := "上海xx公司"
	_ent_code := "987876xxxx"
	v.Set("account", _account)
	v.Set("password", GetMd5String(_account+_password+_app+_name+_id_card_no+_ent_name+_ent_code+_now))
	v.Set("app", _app)
	v.Set("name", _name)
	v.Set("id_card_no", _id_card_no)
	v.Set("ent_name", _ent_name)
	v.Set("ent_code", _ent_code)
	v.Set("time", _now)
	//body := ioutil.NopCloser(strings.NewReader(v.Encode())) //把form数据编下码
	body := strings.NewReader(v.Encode()) //把form数据编下码
	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) //看下发送的结构

	resp, err := client.Do(req) //发送
	defer resp.Body.Close()     //一定要关闭resp.Body
	data, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(data), err)
}

现在注册,即享新用户礼包!

在线咨询
电话咨询

服务热线:

4008 808 898

服务热线(工作时间):

4008 808 898

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

4008 808 898

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

4008 808 898

验证码已发送到您的手机,请查收!

填写验证码后,点击“开通体验账户”自动开通体验账户。

收不到短信验证码?
×