throw new Exception($postForm->error_message); } } catch (Exception $e) { $error = 'ERROR: ' . $e->getMessage() . "\n"; F3::set('error', $error); } } else { //Create Signature form settings object $formSettings = new SignatureFormSettingsInfo(); //To send notification email to owner when form is signed set notifyOwnerOnSign property to true $formSettings->notifyOwnerOnSign = true; //Generate rendon form name $formName = "test form" . rand(0, 500); try { //Create signature form $createForm = $signatureApi->CreateSignatureForm($clientId, $formName, $templateGuid, null, null, $formSettings); //Check status if ($createForm->status == "Ok") { //Set variable for template F3::set("tempalteGuid", $templateGuid); try { //Publish form $postForm = $signatureApi->PublishSignatureForm($clientId, $createForm->result->form->id, $webHook); //Check status if ($postForm->status == "Ok") { $result = "Form is posted successfully"; F3::set("message", $result); //Generate iframe url if ($basePath == "https://api.groupdocs.com/v2.0") { $iframe = 'https://apps.groupdocs.com/signature2/forms/signembed/' . $createForm->result->form->id; //iframe to dev server
//Set base path $signatureApi->setBasePath($basePath); //Check if callback URL is empty if (empty($callbackUrl)) { $callbackUrl = ""; } //Set variables for template F3::set("callbackUrl", $callbackUrl); //Create WebHook object $webHook = new WebhookInfo(); //Set callbackUrl url of webhook which will be triggered when form is signed. $webHook->callbackUrl = $callbackUrl; F3::set("formGuid", $formGuid); try { //Create signature form (it will be copy of original form if formGUID parameter is set) $createForm = $signatureApi->CreateSignatureForm($clientId, "sampleForm" . rand(0, 500), null, null, $formGuid); if ($createForm->status == "Ok") { //Published new form that users can sign it and set callback URL to it $postForm = $signatureApi->PublishSignatureForm($clientId, $createForm->result->form->id, $webHook); //Check status if ($postForm->status == "Ok") { $result = "Form is published successfully"; F3::set("message", $result); //Generate iframe url if ($basePath == "https://api.groupdocs.com/v2.0") { $iframe = 'https://apps.groupdocs.com/signature2/forms/signembed/' . $createForm->result->form->id; //iframe to dev server } elseif ($basePath == "https://dev-api-groupdocs.dynabic.com/v2.0") { $iframe = 'https://dev-apps-groupdocs.dynabic.com/signature2/forms/signembed/' . $createForm->result->form->id; //iframe to test server } elseif ($basePath == "https://stage-api-groupdocs.dynabic.com/v2.0") {