using System;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
class IdCardRecognition
{
// 替换成你的AppKey
private const string AppKey = "YOUR_APPKEY_HERE";
// 获取证件类型方法
public static async Task TypeAsync()
{
try
{
using (HttpClient client = new HttpClient())
{
string url = $"https://api.jisuapi.com/idcardrecognition/type?appkey={AppKey}";
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject jsonarr = JObject.Parse(responseBody);
if ((int)jsonarr["status"] != 0)
{
Console.WriteLine(jsonarr["msg"]);
return;
}
JArray result = (JArray)jsonarr["result"];
foreach (JObject val in result)
{
Console.WriteLine($"{val["typeid"]} {val["typename"]}");
}
}
}
catch (HttpRequestException ex)
{
Console.WriteLine($"请求异常:{ex.Message}");
}
catch (Exception ex)
{
Console.WriteLine($"发生错误:{ex.Message}");
}
}
static async Task Main(string[] args)
{
// 调用获取证件类型方法
await IdCardRecognition.TypeAsync();
// 调用识别身份证图片方法,替换为实际的图片路径
string imagePath = @"C:\Users\Administrator\Desktop\2.jpg";
await IdCardRecognition.RecognizeAsync(imagePath);
}
} 

© 2015-2025 杭州极速互联科技有限公司 版权所有 浙ICP备17047587号-4 浙公网安备33010502005096 增值电信业务经营许可证:浙B2-20190875