运行环境要求
PHP 5.3.3 or higher [http://www.php.net/].
安装
##编译 You can install the bindings via Composer. Run the following command:
composer require linksign/linksign-php-client
To use the bindings, use Composer's autoload:
require_once(__DIR__ . '/vendor/autoload.php');
###手动安装
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file.
require_once('/path/to/linksign-php-client/autoload.php');
###依赖 This client has the following external dependencies:
PHP Curl extension [http://www.php.net/manual/en/intro.curl.php] PHP JSON extension [http://php.net/manual/en/book.json.php] PHP ext-mbstring extension###客户端数字证书配置 linksign-php-client/lib/Configuration.php指定PEM文件的路径:
//私钥文件(PEM格式)路径
protected $privateKeyFile = '';
//证书文件(PEM格式)路径
protected $certFile = '';
#使用
<?php
require_once dirname('linksign-php-client/autoload.php';
class SdkUnitTests extends PHPUnit_Framework_TestCase
{
//签署文档
public function testSignatureDocument()
{
echo "====================== testSignatureDocument() ================== ";
$documentFileName = "/Docs/SignTest1.html";
$documentName = "SignTest1";
$fileExtension = "html";
$api_instance = new SwaggerClientApiDocumentApi();
$client_id = "caba06729b6369fdc0ebbce1"; // string |
$document = new SwaggerClientModelDocument();
$document->setDocumentBase64(base64_encode(file_get_contents(__DIR__ . $documentFileName)));
$document->setName($documentName);
$document->setDocumentIndex("1");
$document->setFileExtension($fileExtension);
$body = new SwaggerClientModelDocumentDefinition(); // SwaggerClientModelDocumentDefinition |
$body->setDocuments(array($document));
try {
$result = $api_instance->createDocument($client_id, $body);
$this->assertNotEmpty($body);
print_r($result);
} catch (Exception $e) {
if(get_class($e->getResponseObject()) == 'SwaggerClientModelApiError')
{
echo "Msg:" . $e->getResponseObject()->getErrMsg()."n";
echo "Code:" . $e->getResponseObject()->getErrCode()."n";
}
echo 'Exception when calling DocumentApi->createDocument: ', $e->getMessage(), "n";
}
}
}
?>
#Demo
linksign-php-client/test/SdkUnitTests.php
#调试工具 注意:调试前,浏览器需要先导入客户端数字证书
https://api.linksign.cn/v1/debug详细的接口文档和技术支持,请联系我们
https://www.linksign.cn
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。