PHP code example of aichenk / icbc-sdk
1. Go to this page and download the library: Download aichenk/icbc-sdk library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aichenk / icbc-sdk example snippets
//参数声明
$appId = '';
$corpNo = '';
$apiUrl = '';
$priKey = "./pri.pem"; //文件地址或字符串内容
$pubKey = "./pub.cer"; //支持字符串/cer/pem,可不传入,不传入则不对内容验签
//初始化
$apiClient = new \Icbc\ApiClient($apiUrl, $appId, $priKey, $pubKey);
$apiClient->setCorpNo($corpNo);
$apiClient->addParams('busisno', '1')
//->addParams('corp_no', $corpNo)
->addParams('cert_type', '0')
->addParams('cert_no', 'xxx');
//接口调用
$response = $apiClient->execute('com.icbc.xxxxx');
//文件上传
$response = $apiClient->upload('./touxiang.png');
//获取结果
if (!$response->isSuccess()) {
throw new \Exception($response->getError());
}
//var_dump($response->getRspData());
var_dump($response->getData());