百度api識別身份證資訊

2021-08-17 08:28:29 字數 981 閱讀 1839

有上述功能。

params = "id_card_side=front&" + urlencoder.encode("image", "utf-8") + "="

+ urlencoder.encode(base64imgstr, "utf-8");

2.token的獲取直接上**:

// 獲取token位址

string authhost = "";

string getaccesstokenurl = authhost

// 1. grant_type為固定引數

+ "grant_type=client_credentials"

// 2. 官網獲取的 api key

+ "&client_id=" + ak

// 3. 官網獲取的 secret key

+ "&client_secret=" + sk;

try

// 定義 bufferedreader輸入流來讀取url的響應

bufferedreader in = new bufferedreader(new inputstreamreader(connection.getinputstream()));

string result = "";

string line;

while ((line = in.readline()) != null)

/** * 返回結果示例

*/logger.info("result:" + result);

根據你所拿到的引數去請求token,獲取結果,這個token是會失效的,所以需要自己進行處理。

然後呼叫httputil.post(idcardidentificate, accesstoken, params);

其中所用的請求資料的工具類httputil:

使用百度ai識別身份證資訊

python 3.5 安裝python sdk pip install baidu ai from aip import aipocr 你的 api key secretkey 你的 secret key 系統分配給使用者的,均為字串,用於標識使用者,為訪問做簽名驗證,可在ai服務控制台中的應用列表...

TP5 百度AI身份證識別

身份證認證 public function code 給予錯誤資訊if res image status normal if res idcard number type 1 如果沒有該使用者存到資料庫 data user id this uid,realname res words result ...

玩轉百度即用API 2 身份證查詢

第二個即用api,身份證查詢 示例 coding utf 8 version 0.1 import urllib.request import json import collections url id card input 輸入你想查詢的身份證號碼 url url id card 完整的url ...