文档签名 api 连接


Docusign api Connect

我在演示 API
的连接中遇到问题
https://demo.docusign.net/restapi要连接到API,我正在使用下面提供的代码。它适用于我的美国同事,但是当我尝试从立陶宛连接时,响应为零。

可能是有任何位置限制,还是我错过了什么?
应该是防火墙中的一些细节(我在 NAT 下)?
我的本地 php/http 服务器是否需要一些特定的配置?

$email = "some email @ fsdfdsf";
$integratorKey = "TEST-xxxxxxxxxxx";
$password = "some password";
$url = "https://demo.docusign.net/restapi/v2/login_information?include_account_id_guid=true";
$header = "<DocuSignCredentials><Username>" . $email . "</Username><Password>" . $password . "</Password><IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("X-DocuSign-Authentication: $header"));
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if($status==200){
    $response = json_decode($json_response, true);
    print_r(json_encode($response['loginAccounts'][0]));
}else{
    print_r($json_response);
}

我发现了一个停止工作上面的源代码。在我的本地服务器上,SSL 未签名。如此简单,仅在测试环境中快速修复可能是关闭 curl 上的 ssl 检查:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

或获取已签名的 SSL 证书。

这就是

我解决它的方式,我添加了$config->setSSLVerification(false); tu 关闭 ssl 验证

 $username = "marko@XXX.com";
$password = "XXX";
$integrator_key = "some_key";     
// change to production before going live
//https://www.docusign.net/restapi
//https://www.docusign.com/p/RESTAPIGuide/Content/GettingStarted/REST%20API%20Version.htm
$host = "https://demo.docusign.net/restapi";
 // create a new DocuSign configuration and assign host and header(s)
$config = new 'DocuSign'eSign'Configuration();
$config->setHost($host);
$config->setSSLVerification(false);
$config->addDefaultHeader("X-DocuSign-Authentication", "{'"Username'":'"" . $username . "'",'"Password'":'"" . $password . "'",'"IntegratorKey'":'"" . $integrator_key . "'"}");
// instantiate a new docusign api client
$apiClient = new 'DocuSign'eSign'ApiClient($config);

DocuSign 不会为 API 客户端实施任何位置限制。

您可以通过尝试从 Web 浏览器使用该服务来检查您的防火墙是否允许连接到 DocuSign。试试 demo.docusign.net

您还可以使用浏览器直接访问 API 服务器中提供有关 API 服务点的信息的方法。

如果它有效,那么您就知道问题出在您的 API 代码中。如果是这样,请先尝试其中一个 API 配方。

如果无法访问 Web 服务,请检查防火墙设置。