Php 来自CodeIgniter的Docusign REST调用

Php 来自CodeIgniter的Docusign REST调用,php,codeigniter,rest,docusignapi,Php,Codeigniter,Rest,Docusignapi,我试图在CodeIgniter应用程序中调用DocuSign REST登录信息。Docusign示例代码显示: // Input your info here: $integratorKey = '...'; $email = '...@....com'; $password = '...'; $name = 'John Doe'; // construct the authentication header: $header = "<DocuSignCredentials><

我试图在CodeIgniter应用程序中调用DocuSign REST登录信息。Docusign示例代码显示:

// Input your info here:
$integratorKey = '...';
$email = '...@....com';
$password = '...';
$name = 'John Doe';

// 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"));

$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

if ( $status != 200 ) {
    echo "error calling webservice, status is:" . $status;
    exit(-1);
}
//在此处输入您的信息:
$integratorKey='…';
$email='…@…com';
$password=“…”;
$name='johndoe';
//构造身份验证标头:
$header=”“$电子邮件。"" . $密码。"" . $积分器键。"";
/////////////////////////////////////////////////////////////////////////////////////////////////
//步骤1-登录(检索baseUrl和accountId)
/////////////////////////////////////////////////////////////////////////////////////////////////
$url=”https://demo.docusign.net/restapi/v2/login_information";
$curl=curl\u init($url);
curl_setopt($curl,CURLOPT_头,false);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl,CURLOPT_HTTPHEADER,数组(“X-DocuSign-Authentication:$header”);
$json\u response=curl\u exec($curl);
$status=curl\u getinfo($curl,CURLINFO\u HTTP\u代码);
如果($status!=200){
echo“调用webservice时出错,状态为:.$status;
出口(-1);
}

我一直收到0的状态响应。当我回显curl时,所有xml标记都已转换为小写(这在Docusign中不起作用)。是否有人在CodeIgniter内完成此调用?你是怎么做到的?我知道我的证书很好,因为我可以执行命令行卷曲并得到响应。

我不确定CodeIgniter在做什么,也不知道为什么标记会转换为小写,但您在文档中是对的,因为DocuSign希望xml标记以大写字母开头,所以这可能不起作用。不过,您可以使用JSON头和请求体

例如,不使用XML格式的身份验证头,如

<DocuSignCredentials>
  <Username>username</Username>
  <Password>password</Password>
  <IntegratorKey>integrator_key</IntegratorKey>
</DocuSignCredentials>
{
    "Username": "username",
    "Password": "password",
    "IntegratorKey": "integrator_key"
}
“节点”仍然以大写字母开头,但由于它不是xml,我想知道CodeIgniter是否可能不使用它。这方面的例子可以在上找到