互联网时代,人工识别身份证信息的方式已不适用于当下社会的发展需求,更需要高效精准的科技程序来支持,在线身份证实名认证接口必不可少。翔云身份证实名认证接口,可助力线上平台与消费者信用相关联,建立完善的客户资源与网络用户的管理。
翔云身份证实名认证接口,实时联网核验用户所提供信息的真伪,api数据的形式便于微信、小程序、h5等页面的快速集成!
以下是GO语言调用翔云身份证实名认证API的代码:
package main
import (
"fmt"
"bytes"
"mime/multipart"
"net/http"
"io/ioutil"
)
func main() {
url := "https://netocr.com/verapi/veriden.do"
method := "POST"
payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
_ = writer.WriteField("img", "/9j")
_ = writer.WriteField("key", "M***********g")
_ = writer.WriteField("secret", "3***********6")
_ = writer.WriteField("typeId", "3003")
_ = writer.WriteField("trueName", "陈**")
_ = writer.WriteField("idenNo", "13***************3")
_ = writer.WriteField("format", "json")
err := writer.Close()
if err != nil {
fmt.Println(err)
return
}
client := &http.Client { }
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Set("Content-Type", writer.FormDataContentType())
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
标签:WriteField,核验,err,fmt,writer,接口,Println,GO From: https://www.cnblogs.com/netocr/p/18080402