互亿无线 · 文档中心

身份证OCR识别 - 代码示例


PHP对接身份证OCR识别DEMO示例
本文为您提供了PHP语言版本的身份证OCR识别的DEMO示例,快速对接调用,轻松完成系统集成,智能识别身份证图片中的文字内容。

身份证OCR识别API接口文档 点击下载

身份证OCR识别接入指南 点击访问



// 接口类型:互亿无线OCR识别接口
// 账户注册:https://user.ihuyi.com/register.html
// 注意事项:
// DEMO仅作参考

header("Content-type:text/html; charset=UTF-8");

function Post($curlPost,$url){
		$curl = curl_init();
		curl_setopt($curl, CURLOPT_URL, $url);
		curl_setopt($curl, CURLOPT_HEADER, false);
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($curl, CURLOPT_NOBODY, true);
		curl_setopt($curl, CURLOPT_POST, true);
		curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
		$return_str = curl_exec($curl);
		curl_close($curl);
		return $return_str;
}

$account = 'APPID';
$password = 'APPKEY';
$app = 'idcard';//固定值
$img_base64 = '';
$img_url = 'http://www.xx.com/xx.png';
$time = time();
$password = md5($account.$password.$img_base64.$img_url.$time);

$target = "https://api.ihuyi.com/ocr/Submit.json";
$post_data = "account=".$account."&password=".$password."&app=".$app."&img_base64=".$img_base64."&img_url=".$img_url."&time=".$time;

//密码可以使用明文密码或使用32位MD5加密
$res =  Post($post_data, $target);
$res_json = json_decode($res,true);

print_r($res_json);

if($res_json['code']==2){
	echo "提交成功";
}

if($res_json['result']['status']==2){
	echo "认证通过";
}

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

在线咨询
电话咨询
服务热线:
4008 808 898



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

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

收不到短信验证码?
×