Posting subscriptions from another website

Advice please.

I have adapted a Feedburner email-only subscription form to post to phplist following the Custom Subscribe Form page. It detects invalid emails but displays a phplist form instead of posting:
`

` This brings up the standard http://www.company.biz/phplist/index.php?p=subscribe form with the email address in the box. So the subscriber who has just entered (say) 'abc@abc.co.uk' must press the Please Confirm button to confirm the subscription.

'p

  • required fields are marked red
    Email address *
    abc@abc.co.uk
    [ Please Confirm]’

Do I need to define ACCESS_CONTROL_ALLOW_ORIGIN in a header to automate the process and where should I put it? Or is there an alternative?

Thank you.

@jitr You probably need to include the subscribe page id in the URL. Then the new subscriber will be redirected to the phplist “thankyou” page.

If you want the subscriber to remain on your web site instead then you need to use an ajax approach. Search this forum for earlier topics that should explain how to do that.

@duncanc. Yes, thanks for the suggestion I tried it again but there is only one subscribe page. As phplist is returning the page I imagine it has decided not to post the data but ask for manual confirmation.

‘action="//www.company.biz/phplist/?p=subscribe&id=1"’

Phplist opens in a new window so the subscriber is still on the website. ajax would be better but more work and learning curve!

@jitr Unless you want a new subscriber to have to confirm their email address then the subscribe page must be set to “don’t display email confirmation”.

@duncanc. Your insights have solved the problem. The “asubscribe” (ajax) case in index.php processes the data posted from my web site. Fwiw my solution was to modify the form tag:

<form action="//www.company.biz/phplist/index.php/?p=asubscribe&id=1" target="_blank" name="subscribeform" method="post" />

and add an echo in index.php to display a response in the new window with a button to close it:

case asubscribe: 'echo 'Response<br><br><button type="button" onclick="javascript:window.close()">Close</button>;'

Many thanks for your advice.

@duncanc Please note I have updated my last post with a solution.

Note need for ?p=asubscribe instead of ?p=subscribe.