I am trying to use the suggested PHP script to post form data to an Acymailing list (see https://docs.acymailing.com/setup/subscription-to-your-lists/rsform-pro-integration#integrate-using-php-code)
The form is here: https://carroll.mdmen.org/index.php/stay-in-touch
It is not working yet and I need help from someone to check what I have. Have I missed something in the below (post processing) code?
`// Load the AcyMailing library
$postData = $_REQUEST['form'];
$ds = DIRECTORY_SEPARATOR;
include_once rtrim(JPATH_ADMINISTRATOR, $ds).$ds.'components'.$ds.'com_acym'.$ds.'helpers'.$ds.'helper.php';
$userClass = new AcyMailing\Classes\UserClass();
// Build the user based on your form's fields
$myUser = new stdClass();
$myUser->email = strip_tags($postData['email']);
$myUser->name = strip_tags($postData['name']);
// If the user already exists update it
$existingUser = $userClass->getOneByEmail($postData['email']);
if (!empty($existingUser)) $myUser->id = $existingUser->id;
// You can add as many extra fields as you want if you already created them in AcyMailing
$customFields = [];
$customFields[1] = $postData['Name'];
$customFields[2] = $postData['Email'];
// the custom field id can be found in the Custom fields list of the AcyMailing admin page
$userClass->sendConf = true; // Or false if you don't want a confirmation email to be sent
$userId = $userClass->save($myUser, $customFields);
// The user now exists in AcyMailing, let's add some list subscriptions
$subscribe = [1]; // Ids of the lists you want the user to be subscribed to need to be added in this array
$userClass->subscribe($userId, $subscribe);`