Library: Campaign Monitor API |
[eluser]Ben Hirsch[/eluser]
Hi all. This is probably not the most elegant solution but it was a nice way to get CM working with CI quickly. 1) Grab the CM php sample from here: http://code.google.com/p/campaignmonitor...loads/list 2) Take the file CMBase.php from the download, rename it to CampaignMonitor.php and put it in your /system/application/libraries/ directory. 3) Find the following function (within the CampaignMonitor class): Code: function CampaignMonitor( $api = null, $client = null, $campaign = null, $list = null, $method = 'get' ) and replace it with: Code: function CampaignMonitor( $api = null, $client = null, $campaign = null, $list = null, $method = 'get' ) 4) Then you can use it like this: Code: function _add_to_cm($email) { ... and you can use this function in your controller. Replace the api and list values with your own. (more info here: http://www.campaignmonitor.com/api/required/) Of course, you can use any CM API method you want. Just look at the documentation. But this will get you started with tunneling commands through the CM wrapper (CMBase.php) without having to make too many edits to the file.
[eluser]Tim Jukes[/eluser]
Just wanted to say thanks for this - works a treat!
[eluser]Tobz[/eluser]
I ended up writing my own CM library. Here it is in case anyone wants to use it. usage: Code: $this->load->library('campaignmonitor', array($api_key)); The Class: Code: <?php |
Welcome Guest, Not a member yet? Register Sign In |