test19393 | Posts: 4

Attempting to Use PHP Sample Code

0 votes
Hi. I am trying to implement the sample code provided at https://developer.esignlive.com/code-share/php-web-form-application-example/ I have changed the API Key to the API key in my account. I believe that is the only thing that needs to be changed, unless I am wrong. private $url = "https://sandbox.esignlive.com/api"; private $key = "XXXXXXXXXX"; private $packageAppend = "/packages/"; private $tokenAppend = "/signerAuthenticationTokens/"; When I attempt to use this sample code, i receive the following error: "Unauthorized Access We're sorry. Your session may have expired. Please try again. If you receive this message multiple times, please contact support." See attachment.

harishaidary | Posts: 1812

Reply to: Attempting to Use PHP Sample Code

0 votes
Hi, Yes, in my example you should technically only need to change the api_key placeholder to get it working. I see in your screenshot that you are using Safari. Have you tried enabling third-party cookies? By default, Safari blocks the cookies of the website inside the iframe.

test19393 | Posts: 4

Reply to: Attempting to Use PHP Sample Code

0 votes
Haris - I tried it in Ffox - still not working. See screen shot. (Same thing in Chrome too). To confirm, for my api_key, I am using the 36-character string found under "Integrations" in the Admin panel, right? Thanks.

Attachments
A.png253.46 KB
test19393 | Posts: 4

Reply to: Attempting to Use PHP Sample Code

0 votes
Haris - The sample code has an error which resolves the issue. Wrong: $doc = file_get_contents("documents\sample_contract2.pdf"); Right: $doc = file_get_contents("documents/sample_contract2.pdf");

harishaidary | Posts: 1812

Reply to: Attempting to Use PHP Sample Code

0 votes
That's weird. Because I tried with
$doc = file_get_contents(“documents\sample_contract2.pdf”);
and it worked perfectly fine for me. Glad you got it working.

test19393 | Posts: 4

Reply to: Attempting to Use PHP Sample Code

0 votes
I don't think Mac/Unix allows "\" for directory paths.

nayanj | Posts: 2

Reply to: Attempting to Use PHP Sample Code

0 votes
Hi, I am trying to implement the sample code provided at https://developer.esignlive.com/code-share/php-web-form-application-example/ and in the documents folder there is a pdf file named "sample_contract2.pdf" i have added another file named "CustomerServicesAgreementForm2017.pdf". Now in ESLPackageCreation.php after replacing file_get_contents("documents/sample_contract2.pdf") by file_get_contents("documents/CustomerServicesAgreementForm2017.pdf") I am getting this error. "Unauthorized Access We're sorry. Your session may have expired. Please try again. If you receive this message multiple times, please contact support. Wed Mar 29 05:54 UTC 2017" However it is working fine for file_get_contents("documents/sample_contract2.pdf").

Attachments
esign.png132.51 KB
harishaidary | Posts: 1812

Reply to: Attempting to Use PHP Sample Code

0 votes
Hi Kunal, The reason why you are getting that error is because in my code, I am extracting the form fields from the sample PDF I included in the zip file. Now, if you are going to use a different document, then you will need to either add form fields in your PDF for extraction or modify your code to use x-y coordinates.

nayanj | Posts: 2

Reply to: Attempting to Use PHP Sample Code

0 votes
Thanks Haris, Can you please send us some link or reference when we use different PDF file. As I am not familiar with PDF extraction or modify codeusing x-y coordinates.

jem__dev | Posts: 11

Reply to: Attempting to Use PHP Sample Code

0 votes
I can't get this working.. same thing goes for me private $url = "https://sandbox.esignlive.com/api"; private $key = "XXXXXX"; private $packageAppend = "/packages/"; private $tokenAppend = "/signerAuthenticationTokens/"; SHOWS: Unauthorized Access We're sorry. Your session may have expired. Please try again. If you receive this message multiple times, please contact support. Wed Jan 17 19:55 UTC 2018 Can you help me?

harishaidary | Posts: 1812

Reply to: Attempting to Use PHP Sample Code

0 votes
Hi there, Are you using the document I provided in the sample code? What URL are you building to embed in your iframe? Is the transaction getting created successfully and is in SENT status?

jem__dev | Posts: 11

Reply to: Attempting to Use PHP Sample Code

0 votes
yes I downloaded and try to run in localhost .. Where can I check that ?

jem__dev | Posts: 11

Reply to: Attempting to Use PHP Sample Code

0 votes
when i try to check this part https://sandbox.esignlive.com/access?sessionToken= $token['value'] -- This is EMPTY

harishaidary | Posts: 1812

Reply to: Attempting to Use PHP Sample Code

0 votes
You can have a look by logging in the web portal: sandbox.esignlive.com

jem__dev | Posts: 11

Reply to: Attempting to Use PHP Sample Code

0 votes
my problem is that the PDF part on the thankyou.php is not showing

Attachments
harishaidary | Posts: 1812

Reply to: Attempting to Use PHP Sample Code

0 votes
I understand that. In order for the PDF to appear, the package needs to be in SENT status. If it isn't then you'll an error like in your screenshot. Can you confirm that your packages get created and is in SENT status by logging to the web portal?

jem__dev | Posts: 11

Reply to: Attempting to Use PHP Sample Code

0 votes
Here what I have

Attachments
package-1.png116.54 KB
jem__dev | Posts: 11

Reply to: Attempting to Use PHP Sample Code

0 votes
{"status":"SENT"}

harishaidary | Posts: 1812

Reply to: Attempting to Use PHP Sample Code

0 votes
You only have one package in your account, which was created through the web portal. Hence, your packages are not being created. Are you sure you are using the correct api key?

jem__dev | Posts: 11

Reply to: Attempting to Use PHP Sample Code

0 votes
I am sure its in my account

Attachments
api.png15.44 KB
harishaidary | Posts: 1812

Reply to: Attempting to Use PHP Sample Code

0 votes
Just to make sure, you are not using "xxxx-xxxx-xxxx-xxxx-xxxx-xxxx" as an api key correct? You've clicked on the eye icon on the right and copied the actual api key?

jem__dev | Posts: 11

Reply to: Attempting to Use PHP Sample Code

0 votes
yes I did that (lol) please do check the attach imaged and let me know if that is right? just what to check every function which might resolve my issue

Attachments
check-1.png33.21 KB
harishaidary | Posts: 1812

Reply to: Attempting to Use PHP Sample Code

0 votes
Just wanted to make sure haha. The first thing I can see is that you'll need to update the sender information with yours. "[email protected]" isn't a sender in your account. Hence, it will throw an error. You can actually remove that part in the array.

jem__dev | Posts: 11

Reply to: Attempting to Use PHP Sample Code

0 votes
My comments are getting longer (sorry) but I really do want to work this on my side please check the image attached .. the packageID is Empty which I think it shouldn't

Attachments
check-2.png47.09 KB
harishaidary | Posts: 1812

Reply to: Attempting to Use PHP Sample Code

0 votes
You are getting an empty packageId because the package creation call is failing. Can you post the error message that you are getting from the package creation call?

jem__dev | Posts: 11

Reply to: Attempting to Use PHP Sample Code

0 votes
-Haris :D I finally got it! THANK YOU ! so it seem that the link is missing "/" for example: packagepackageId Right: package/packageID so this part on the code $status = $this->sendRequest($this->packageAppend .'/'. $packageId['id'] . '/documents', $documentJSON, $doc, NULL); and this one too $this->sendRequest($this->packageAppend .'/'. $packageId['id'], $sendJSON, NULL, 'application/json');

jem__dev | Posts: 11

Reply to: Attempting to Use PHP Sample Code

0 votes
I have question though the SiGNER is me what if he/she is a new user will they able to create their own signature ? (Which one of the factors I like) or they required to signup first and create there account ?

harishaidary | Posts: 1812

Reply to: Attempting to Use PHP Sample Code

0 votes
Hi, Glad you were able to resolve your issue. When you add a signer to a package, he or she doesn't need to have an esignlive account. You can assign signatures for them on the documents through the API. However, if you plan to send packages on behalf of your users or you want your users to place themselves their signatures on the documents, then they will have to have an esignlive account.

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off