Welcome Guest, Not a member yet? Register   Sign In
Porting MailChimp to CI
#1

[eluser]jpcody[/eluser]
Hey folks, I'm looking to port a working MailChimp script to CI; not looking to do much fancy here, and I understood from the docs what needed to happen was creating a new library in system/libraries, where I would place the MailChimp API wrapper, then place my call in a new method. But it appears my library has gotten borked. There are apparently no syntax errors, but I'm getting a white screen of death. Here is my controller code:

Code:
<?php

class Mail extends Controller {

    function storeAddress(){
        $data['email'] = $this->input->post('email');
        $data['api'] = '[apikeyhere];
        $data['list_id'] = '[listidhere]';
        $this->load->library('Mcapi',$data);
        
        // Validation
        if(!$data['email']){ return "No email address provided"; }
    
        if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/i", $data['email'])) {
            return "Email address is invalid";
        }
            
        if($this->mcapi->listSubscribe($data['list_id'], $data['email'], '') === true) {
            // It worked!    
            return 'Success! Check your email to confirm sign up.';
        }else{
            // An error ocurred, return error message    
            // return 'Error: ' . $api->errorMessage;
            return 'Error: Doh';
        }
        
    }

}

In the actual library, I can echo out values all the way until the output buffer begins. Then things seem to stop working. Any ideas where I'm going wrong?

The code is too long to paste here, so I've placed it at http://droplr.com/12Fd5u

Thanks so much for any pointers you could give on implementing this. Mega bonus points if you can help me learn whatever I'm screwing up.


Messages In This Thread
Porting MailChimp to CI - by El Forum - 05-20-2010, 06:24 PM
Porting MailChimp to CI - by El Forum - 05-20-2010, 06:31 PM
Porting MailChimp to CI - by El Forum - 05-20-2010, 06:39 PM
Porting MailChimp to CI - by El Forum - 05-20-2010, 08:09 PM
Porting MailChimp to CI - by El Forum - 05-20-2010, 11:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB