Docusign First API调用

时间:2015-05-24 10:56:40

标签: docusignapi

$email = "xxxxxxxxxxx";
$password = "xxxxxxxx";
$integratorKey = "INTE-0f494cd8-d0c4-4cd1-9f46-85a86435d749";
$header = "<DocuSignCredentials><Username>" . $email . "</Username><Password>" . $password . "</Password><IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>";

$url = "https://demo.docusign.net/restapi/v2/login_information";
$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"));
$curl_error=curl_error($curl);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ( $status != 200 ) {
echo "error calling webservice, status is:" . $status;
exit(-1);
}
$response = json_decode($json_response, true);
$accountId = $response["loginAccounts"][0]["accountId"];
$baseUrl = $response["loginAccounts"][0]["baseUrl"];
curl_close($curl);
//--- display results
echo "accountId = " . $accountId . "\nbaseUrl = " . $baseUrl . "\n"; 

这是DocuSign所说的,用于检索帐户ID和基本URL。但就我而言,它总是说:

  

调用webservice时出错,状态为:0

我做错了什么?我在我的本地xampp服务器上尝试它。

1 个答案:

答案 0 :(得分:0)

听起来您的CA不包含DocuSign Certficiate的正确更新。

您是否可以将此添加到您的代码中以查看它是否正常工作,如果是,那么您将不得不修复CA(我建议不要这样做,因为它会禁用Cert检查)。

curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);