我正在尝试下载一个卷曲的文件信封。我正在访问信封,但无法显示pdf。我看到一个带有符号的网页,无法保存信封的pdf。任何帮助表示赞赏。
require_once('rest/autoload.php');
$url = "https://demo.docusign.net/restapi/v2/login_information";
$header = "<DocuSignCredentials><Username>" .
$config['username_docusign'] . "</Username><Password>" .
$config['password_docusign'] . "</Password><IntegratorKey>" .
$config['api_firmadoc'] . "</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 ) {
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);
$curl = curl_init("https://demo.docusign.net/restapi/v2/accounts/1319127/envelopes/cc4aa62f-506c-4ee4-b6a3-dc9ae3e5fa14/documents/combined" );
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/pdf',
'X-DocuSign-Authentication: { "Username":"****", "Password":"****",
"IntegratorKey":"*****" }' )
);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
echo $json_response;
我希望得到一个pdf文件,但是我收到了一个带符号的网页
答案 0 :(得分:0)
Accept
标头设置为application/pdf
)header("Content-type:application/pdf");
请参见this SO answer。查看PHP JWT和Authorization Code Grant示例以获取更多信息。
感谢您与DocuSign集成!