For those of you that use PHP, here is a quick script you can use to send data to your documents and data routes.
$data = array(
'OrgName' => 'Org 1',
'OrgAddress' => 'Address 1',
'OrgCity' => 'Orlando',
'OrgState' => 'FL',
'OrgZip' => '32819'
);
$json_data = json_encode($data);
$url = 'https://www.webmerge.me/merge/10690/me1ket';
//open connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($json_data))
);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
if ($result) {
$response = 'Document created successfully. Check WebMerge for more details.';
} else {
$response = 'No documents created.';
}
echo $response;
Combine PDF Documents
If you'd like to send all your data for multiple merges (of the same document) at once and receive back a "combined" document with all of the individual merges as separate pages, you just need to make one minor adjustment to the code above
$data = array(
'_combine' => array(
array(
'OrgName' => 'Org 1',
'OrgAddress' => 'Address 1',
'OrgCity' => 'Orlando',
'OrgState' => 'FL',
'OrgZip' => '32819'
),
array(
'OrgName' => 'Org 2',
'OrgAddress' => 'Address 2',
'OrgCity' => 'Orlando',
'OrgState' => 'FL',
'OrgZip' => '32819'
),
)
);
Notice the individual data sets are wrapped in an array that has a key "_combined". This tells the merge system to create a document with each array inside the _combined key and then create a single PDF