Q: Do you have some PHP sample code to create a newsletter subscription form using your API ?
I need to have the subscription form on my website which should post the user data to a PHP script which should than add the user data to a list on your server.

Laura_Email_Marketing
May 14, 2024A: Hi Julian,
I am sorry, but we don't provide that kind of example. The scenario you mention refers to quite a general programming knowledge that is out of the scope of our service.
It is easier if you include a subscription form created in Acumbamail, but if this doesn't fit your needs (maybe because on submit you need to execute extra actions), you can proceed as follows:
- Create your own subscription form on your website
- Customize the onsubmit event. Here is where you will execute all the needed actions plus make a request to Acumbamail
You can use our API or our incoming webhooks to include the new subscriber:
- https://acumbamail.com/apidoc/function/addSubscriber/
- https://en.soporte.acumbamail.com/article/224-webhooks-de-entrada#suscribir
Once you are at this point, in case you have some doubts, you can contact our support team and provide your code so that we can double-check in case it is not working as expected (missing or wrong parameter, the way you authenticate your request, etc.).
Best regards
Thank You very much. I will do this.
BTW - I like the subscription forms and they support custom fields, too. That is something I was looking for so long.
(I was asking for PHP because the subscribers will see the subscription form in a restricted area and the initail data would come from my database which already exists.)