subject(); //create new instance of aweber using our dev creds $app = new AweberAPI(Configure::read('aweber.consumerKey'), Configure::read('aweber.consumerSecret')); //get our aweber account $account = $app->getAccount(Configure::read('aweber.accessToken'), Configure::read('aweber.accessSecret')); //find the list id that we want to subscribe the email to $get_list = $account->lists->find(array('name' => $params['list_id'])); $get_list = $get_list[0]; $listUrl = "/accounts/$account->id/lists/$get_list->id"; $list = $account->loadFromUrl($listUrl); //create the new email array $subscriber = array( 'email' => $params['email'], 'name' => $params['first_name'].' '.$params['last_name'], 'custom_fields' => array( 'client_token' => $params['client_token'], 'sub_id1' => $params['sub_id1'], 'sub_id2' => $params['sub_id2'] ) ); CakeLog::debug('aweber subscriber: '.print_r($subscriber, true), 'debug'); //subscribe them! try { $list->subscribers->create($subscriber); } catch(Exception $exc) { error_log("AWeber error on subscribe: ".print_r($exc, true)); } }