Code sample: CreateSignPosting - PHP

<< Click to Display Table of Contents >>

Navigation:  Reference > Code samples >

Code sample: CreateSignPosting - PHP

 

ini_set('soap.wsdl_cache_enabled',0);

ini_set('soap.wsdl_cache_ttl',0);

 

$atservices_wsdl = "https://test3.signant.no/WS/V1/PostingsService.svc?wsdl";

$atservices_client = new SoapClient($atservices_wsdl, array("trace" => 1, "exception" => 0));

print_r($atservices_client);

 

$DistributorID = 'Contact Signant for DistributorID';

$AccessCode = 'Contact Signant for AccessCode';

$tomorrow1 = mktime(0, 0, 0, date("m") , date("d")+1, date("Y"));

$after3days = mktime(0, 0, 0, date("m") , date("d")+3, date("Y"));

$activeTo1 = date("Y-m-d H:i:s", $tomorrow);

$WillBeDeletedDateTime = date("Y-m-d H:i:s", $after3days);

 

$tomorrow = '2014.10.10 00:00:00';

$activeTo = '2014.10.10 00:00:00';

$after3days= '2014.10.10 00:00:00';

 

$activeTo = str_replace(' ', 'T', $activeTo);

$WillBeDeletedDateTime = str_replace(' ', 'T', $WillBeDeletedDateTime);

 

echo $tomorrow;

echo '<br>';

echo $activeTo;

 

$postingAdmins = array(

 

array(

'Name'=> 'Admin',

'Email'=> 'example@company.com',

'MobileNumber'=> '1111',

'SSN'=> '00000000001',

'NotifyByEmail'=> true

)

);

 

 

$recipients = array(

 array(

 'Name'=> 'Testing Recipient1',

 'Email'=> 'example@company.com',

 'MobileNumber'=> '2222',

 'SSN'=> '00000000002',

 'Priority'=> 0

 )

);

 

 

$file_name = "c:\\tmp\\test.pdf";

$file_handle = fopen($file_name, "r");

$file_contents = fread($file_handle, filesize($file_name));

fclose($file_handle);

 

$attachments = array(

 array(

 'File'=> $file_contents,

 'FileName'=> $file_name,

 'Description' => 'Testing',

 'ActionType' => 'Sign'

 )

);

 

$SignPosting = array(

 'DistributorSystemID' => 'Testing',

 'Title'=>'Testing',

 'ActiveTo'=> $activeTo,

 'WillBeDeletedDateTime' => $WillBeDeletedDateTime,

 'UseWidget' => true,

 'PostingAdmins' => $postingAdmins,

 'Recipients' => $recipients,

 'Attachments' => $attachments,

 'AutoActivate' => true,

 'UseWidget' => true

);

 

 

 

$result = $atservices_client->CreateSignPosting(array("DistributorID" => $DistributorID, "AccessCode" => $AccessCode, "SignPosting" => $SignPosting));

 

print_r($result);