Php Docusign Api不工作
我已经使用了这个API代码。它显示一个错误“调用webservice时出错,状态为:0”。 我想在我的网站中添加Docusign,但无法添加Php Docusign Api不工作,php,Php,我已经使用了这个API代码。它显示一个错误“调用webservice时出错,状态为:0”。 我想在我的网站中添加Docusign,但无法添加 <?php // Input your info here: $email = "***"; // your account email (also where this signature request will be sent) $password = "****"; // your account password
<?php
// Input your info here:
$email = "***"; // your account email (also where this signature request will be sent)
$password = "****"; // your account password
$integratorKey = "***"; // your account integrator key, found on (Preferences -> API page)
$recipientName = "***"; // provide a recipient (signer) name
$templateId = "***"; // provide a valid templateId of a template in your account
$templateRoleName = "***"; // use same role name that exists on the template in the console
// construct the authentication header:
$header = "<DocuSignCredentials><Username>" . $email . "</Username><Password>" . $password . "</Password><IntegratorKey>" . $integratorKey . "</IntegratorKey></DocuSignCredentials>";
/////////////////////////////////////////////////////////////////////////////////////////////////
// STEP 1 - Login (to retrieve baseUrl and accountId)
/////////////////////////////////////////////////////////////////////////////////////////////////
$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_setopt($curl, CURLOPT_HTTPHEADER, array("X-DocuSign-Authentication: $header"));
$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 "\naccountId = " . $accountId . "\nbaseUrl = " . $baseUrl . "\n";
/////////////////////////////////////////////////////////////////////////////////////////////////
// STEP 2 - Create and envelope using one template role (called "Signer1") and one recipient
/////////////////////////////////////////////////////////////////////////////////////////////////
$data = array("accountId" => $accountId,
"emailSubject" => "DocuSign API - Signature Request from Template",
"templateId" => $templateId,
"templateRoles" => array(
array( "email" => $email, "name" => $recipientName, "roleName" => $templateRoleName )),
"status" => "sent");
$data_string = json_encode($data);
$curl = curl_init($baseUrl . "/envelopes" );
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string),
"X-DocuSign-Authentication: $header" )
);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ( $status != 201 ) {
echo "error calling webservice, status is:" . $status . "\nerror text is --> ";
print_r($json_response); echo "\n";
exit(-1);
}
$response = json_decode($json_response, true);
$envelopeId = $response["envelopeId"];
// --- display results
echo "Document is sent! Envelope ID = " . $envelopeId . "\n\n";
?>
请任何人都可以帮助我,在这个过程中。我搜索了所有API,但显示了相同的错误。将下面给出的这一行放在下面
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
在这一行之后,
curl_setopt($curl,CURLOPT_HTTPHEADER,数组(“X-DocuSign-Authentication:$header”)代码>希望您的问题能得到解决。对我来说似乎是服务器限制问题哪种类型的服务器限制问题?我使用的代码正确吗?谢谢你的支持,先生。你能告诉我一些事情吗,我怎样才能在我的网站上集成docusign。我想在我的文档中设置一个签名框,该签名框是在填写表单后生成的。提交后,此表单将以pdf格式生成。