Я пытаюсь скачать конверт docusign с curl. Я получаю доступ к конверту, но 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, но получил веб-страницу с символами