ddocs / php-sdk
连接 DigitalDocs 服务的 SDK。
dev-master
2020-01-10 16:53 UTC
Requires
- php: ^7.0
Requires (Dev)
- phpunit/phpunit: ^8
This package is auto-updated.
Last update: 2024-09-11 03:00:08 UTC
README
调用 https://digitaldocs.com.mx/storage/client-services.wsdl 的库。
通过实现安全字段轻松连接到 Digital Docs WSDL。只需安装并调用即可(就像 DigitalDocs 一样简单)。
要求
- PHP >= 7.0.0
- SoapClient 扩展
安装
composer require ddocs/php-sdk
使用
use DDocs\SOAP as DDSoap; class Example { public function stamp(array $params) { $u = 'YOUR_USER'; $k = 'Key_fe239e5985321499ae656b5139d11ce1'; $conection = DDSoap::getConection($u, $k); die( $conection->do('stamp', $params) //or just ,\DDocs\SOAP::getConection($u, $k)->do('stamp', $params) ); } }
'do' 方法可能会失败,因此我们建议使用 try-catch 块。
try { \DDocs\SOAP::getConection($u, $k)->do('welcome', 'visitor'); //"Hola : Bienvenido visitor a los servicios de timbrado DigitalDocs" } catch (\Exception $e) { echo 'Cant conect:'.$e->getMessage(); }
其他方法
$conection->getMethods(); //Array [ // 0 => "string welcome(string $user, string $pss, string $key, string $name)" //] $conection->getRequest(); //StdClass { // headers => string // POST /ws/webService HTTP/1.1 // Host: digitaldocs.com.mx // Connection: Keep-Alive // User-Agent: PHPSoapClient // Content-Type: text/xml; charset=utf-8 // SOAPAction: "welcome" // Content-Length: 412 // // ,body => string // <?xml version="1.0" encoding="UTF-8"?> // <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><user>96a7e87c38abde431c4eb64bcedac3b2c65b36b6921b41bab67215d702957bb8</user><pss>96a7e87c38abde431c4eb64bcedac3b2c65b36b6921b41bab67215d702957bb8</pss><key>fdd347050b63f31b8542d5b8ac1ec5e7c43568312f6f327a9140fd783ed8bd26</key><name>visitor</name></SOAP-ENV:Body></SOAP-ENV:Envelope> //} $conection->getResponse(); //StdClass { // headers => string // HTTP/1.1 200 OK // Date: Fri, 10 Jan 2020 06:07:59 GMT // Server: Apache // Content-Length: 265 // Keep-Alive: timeout=5, max=100 // Connection: Keep-Alive // Content-Type: text/xml; charset=utf-8 // // ,body => string // <?xml version="1.0" encoding="UTF-8"?> // <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><welcomeResponse>Hola : Bienvenido visitor a los servicios de timbrado DigitalDocs</welcomeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> //}
鸣谢
- Jesus Alvarez