idfy-eve / php
此包已被废弃,不再维护。没有建议的替代包。
此包最新版本(dev-master)的许可信息不可用。
IDfy集成Web SDK(任务API)
dev-master
2018-10-16 13:26 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2020-10-28 22:40:48 UTC
README
PHP WEB SDK
用于与IDfy-API集成的PHP包。
用于请求IDfy的提取和验证引擎服务的实用工具。
##安装
1. Ensure you have composer installed. Here is a link : https://getcomposer.org/download/ 2. Add the following requirement to your composer.json file present in the project : "require": { "idfy-eve/php": "dev-master" } 3. Run "composer require idfy-eve/sdk-php" from your project root directory 4. Add the following in your main php script: "require_once __DIR__ . '/vendor/autoload.php';"
##客户端初始化
- 在仪表板上设置您的API密钥 - plans.idfy.com
$client = new Client($apikey="<YOUR API_KEY>", account_id="YOUR_ACCOUNT_ID");
请确保API_KEY作为字符串包含在内。
###用法
#####POST请求
- 对API进行调用以进行服务请求。(参考此处各种服务(或)任务类型 - https://api-docs.idfy.com/v2/#task-types)。
$client->post_request($task_type="pan_ocr", $task_id="4d4ggg87-53e5-4b6e-947a-04655eed588b", $data=array("doc_url"=> "https://tiimg.tistatic.com/fp/1/003/642/pan-card-ser554.jpg",);
- 必填参数:task_type (string),task_id (string),data (dictionary)
- 可选参数:group_id (string)
- 确保task_type与在文档中找到的完全一致。
- 严格遵循文档中提到的任务类型的相应请求架构。
- 响应体中的request_id是一个唯一标识符,将用于查询API调用的响应。
- 对上述API请求的响应
{ "status": 202, "request_id": "e53992c5-6d6f-4d85-bc36-07f7442f91bc" }
#####GET响应
- 进行API调用,接收上一步骤中请求的响应。request_id - 在上一步骤中生成,将作为获取响应的参数。
Syntax : $client->get_response($request_id,$group_id,$task_id) Example: $client->get_response($request_id="e53992c5-6d6f-4d85-bc36-07f7442f91bc") or $client->get_response(null,$group_id="group-id")
- 必填参数 - request_id (string)。
- 上述API调用返回的响应
[ { "status": "completed", "request_id": "e53992c5-6d6f-4d85-bc36-07f7442f91bc", "task_id": "4d48c187-53e5-4b6e-947a-04655eed588b", "group_id": "d468f87e-8e7b-4422-83eb-2edf4c1cfb95", "created_at": "2018-09-03T08:12:57+00:00", "completed_at": "2018-09-03T08:13:07+00:00", "tat": "10.081501662", "ocr_output": { "pan_number": "BJAPS7****", "pan_type": "Individual", "name_on_card": "Sr*****", "fathers_name": "Ven*******", "date_on_card": "1984-04-07", "date_of_issue": "2006-12-27", "age": 34, "is_scanned": false, "minor": false, "raw_text": "INCOME TAX DEPARTMENT\nGOVT OF INDIA\nSRXXXXXXX G V\nVEN********\n07/04/1984\nPermanent Account Number\nBJAPSXXXX\nSignature\n" } } ]