Using cURL to POST form to two places

二次信任 提交于 2019-12-01 11:11:28

If I understand correctly: you want to POST data locally first then let the form POST to Mailchimp. If that is what you are trying to do, then using some JS connected to the form (or a form button) is probably the best way to go. I think it is the proper way to go in your situation.

Something jQuery like below would work to POST the form locally first, and once that request is complete it would submit the form using the given action url (mailchimp).

$(document).ready(function(){
    $('#submit-button').click(function(event){
        event.preventDefault();
        $.post("your_email_parser.php", $('#form-id').serialize(), function(){
            $('#form-id').submit();
        });
    });
});

...

<form id='form-id' action='http://myMailchimpUser.us2.list-manage.com/subscribe/post' method='post'>
    ...
    <input type='submit' id='submit-button' />
</form>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!