Auto update / import a Subscibers List


Many of the sites that we build have the option for users to add their details for varying purposes as well as joining a subscribers list.  Currently the method I have implemented for a user to add their details to whatever DB we require for the clients site and also to Campaign Monitor at the same time is to copy the 'add a subscribe form' code from CM and use the field names, params, URL as required.



if (error checking is ok){
      add to the site DB as required;


This does what I need it to do locally then goes to CM and adds the supplied email address and name param to my subscribers list.  It then goes back to the supplied subscribe confirmation page.

What I would like to do is write a script (php in my case) which I can then automatically run (either once a week or month via a crontab or perhaps just before a campaign is sent) which will loop thru my local DB and add each email address and any other details I specify to my CM based subscribers list.  The CM error checking will prevent details being added more than once or added again if they have unsubscribed.

The issue with doing it in the method supplied above is that it only works for one individual email account being added, as when it reaches the go to confirmation page the process finishes.

I'm not quite sure how I can do this for more than 1 email address.  Perhaps I could set the confirmation page to be the same script and pass a param in the URL telling it to increment by 1 and if the passed value is less than the number of entires in the DB to run again inserting the next entry.  However this process doesn't strike me as being a very efficient method of doing this.

Has anybody done anything like this before and has an example I could use to help?  Or is this entirely impossibe?

Any help or advice would be greatly appreciated.

Many Thanks


kingbeastie, 9 years ago

Nobody got any ideas / suggestions / comments?

Jason Jason, 9 years ago

Hi Steve,

I'd suggest making use of our API to do this. There is a Subscriber.Add method, which you can call for individual subscribers (in your case while iterating over a collection) that adheres to the usual Campaign Monitor rules in regards to duplicates and previous unsubscriptions. You can check it out at, including some PHP examples which should get you going. Get in touch with support if you have any further questions or run into any trouble.

200,000 companies around the world can't be wrong.

From Australia to Zimbabwe, and everywhere in between, companies count on 
Campaign Monitor for email campaigns that drive real business results.

Get started for free