0

What I'm trying to achieve is auto submit a subscribe form (with specific user details) to my email provider (similar to mailchimp), when a new user register to my joomla site.

I already defined a plugin with an event that triggers when a new user register to my site.

But I'm really not sure how to auto submit a form or a url with the user details.

For example, the following line would do what I need but I don't know how to trigger it from my plugin:

https://cp.responder.co.il/subscribe.php?fields[subscribers_name]=Test&fields[subscribers_email]=test@test.com&form_id=1234&encoding=UTF-8

Any ideas how can I accomplish this would be really appreciated.

Thanks! Omri

1

Firstly, a plugin does not usually generate a form. They are mostly oriented for internal processing.

In general, a module is the right place to generate a form. Then, a form have an action field were you can define the external Url to submit it. Additionally, you can define a method, either post or get (in your case a get). Finally, you can define the form fields to match your requirements.

Ref: https://developer.mozilla.org/en/docs/Web/HTML/Element/form

  • Thank you. So how do I send the user registration information to other url that handles my auto-responders (like mailchimp). As I wrote, when a user register to my site, I want to send the user info to my auto-resopnder service. I though it would be easier to simulate the form subscribe. Is there another way? Thanks! – Omri Dec 26 '15 at 13:54
  • 2
    I would recommend to manage your mailing in AcyMailing and integrate a SMTP delivery service like SendGrid, PostMark, or Amazon SNS. – Anibal Dec 27 '15 at 17:47
0
$content = http_build_query (array (
            'fields[subscribers_name]' => $user['name'],
            'fields[subscribers_email]' => $user['email'],
            'form_id' => '1234',
            'encoding' => 'UTF-8'
            ));

            $context = stream_context_create (array (
            'http' => array (
            'method' => 'POST',
            'content' => $content,
            )
            ));

            $result = file_get_contents('https://cp.responder.co.il/subscribe.php', null, $context);

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.