The code appears to hardcode many things, and that may or may not be the issue.
First I see this:
CURLOPT_URL => ' https://demo.docusign.net/restapi/v2.1/accounts/123456789/envelopes',
The 123456789 is, I assume, your accountID, is this a GUID? or a short numeric value? are you sure you have the right accountID in there?
Then I see this:
CURLOPT_HTTPHEADER => array ('Authorization: Bearer eyJ0****'),
First, do you hardcode a token? that won’t work, tokens expire after 8 hours. If you don’t do that, how do you obtain it using JWT? do you have a consistent code that does this every time you need one? I would suggest trying to use the PHP SDK that does this for you. You can find this code in https://github.com/docusign/code-examples-php/blob/master/JWTConsoleApp/JWTConsoleApp.php
Third, I suggest you have code like this:
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization': 'someAuthorization',
'x-api-key': 'somekey',
'Content-Type': 'application/x-www-form-urlencoded'
));
You need to set multiple headers, not just one
These headers are also needed:
'--header' "Accept: application/json" \
'--header' "Content-Type: application/json")