...
Info | ||
---|---|---|
| ||
Universal Module product service field names are used for the email tag. For example, a service field with the name "hostname" would result in a tag available to the welcome email of {service.hostname}. Universal module products are unique in this regard because each product may have different tags, defined by the staff member who created them. |
Tools
Here's a sample PHP script you can use as a test endpoint to see the data that is received via POST when defining a Post URL instead of an email for any of the Package or Service Notices.
Create a file called post.php and test.txt that is writable by the web server, upload those files to a location such as yourdomain.com/post.php and use this URL as your Post URL in your Universal Module Product configuration.
Code Block | ||
---|---|---|
| ||
<?php
// Check if the request method is POST
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Get the POST data
$postData = file_get_contents('php://input');
// Parse the URL-encoded data into an associative array
parse_str($postData, $dataArray);
// Specify the file name
$fileName = 'test.txt';
// Convert the array to a readable string format
$formattedData = print_r($dataArray, true);
// Attempt to write the formatted data to the file
if (file_put_contents($fileName, $formattedData) !== false) {
// Send a success response
http_response_code(200);
echo "Data successfully written to $fileName.";
} else {
// Send an error response if unable to write
http_response_code(500);
echo "Failed to write data to $fileName.";
}
} else {
// Send a method not allowed response if the request is not POST
http_response_code(405);
echo "Method not allowed. Please use a POST request.";
}
?>
|
Set the URL for the notice to the location of post.php and perform the action. Then check the test.txt file for the results. You should see something like this in the file:
Expand | ||
---|---|---|
| ||
Array [1] => Array ) [pricing] => Array ) [groups] => Array [1] => Array ) [name] => Test ) [names] => Array [1] => Array ) [descriptions] => Array [1] => Array ) [description] => [_action] => service_notice_add [date_added] => 2024-08-02 19:13:13 ) |