Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

mailchimp put all the name and email from mysql php to mailchimp

I think this task would use mailchimp api

I have name (firstname, lastname but can concat if mailchimp has name)
and email

as columns in the users database

I want to bring name,email to mailchimp account using api
Avatar of sivagnanam chandrakanth
sivagnanam chandrakanth
Flag of India image

Download mailchimp PHP API here

http://apidocs.mailchimp.com/api/downloads/#php

Extract the file, in the examples folder you will have mcapi_listUpdateMember.php file.

It has the code for you..

require_once 'inc/MCAPI.class.php';
require_once 'inc/config.inc.php'; //contains apikey

$api = new MCAPI($apikey);

$merge_vars = array("FNAME"=>'Richard', "LNAME"=>'Wright');

$retval = $api->listUpdateMember($listId, $my_email, $merge_vars, 'html', false);

if ($api->errorCode){
      echo "Unable to update member info!\n";
      echo "\tCode=".$api->errorCode."\n";
      echo "\tMsg=".$api->errorMessage."\n";
} else {    
      echo "Returned: ".$retval."\n";
}
Avatar of rgb192

ASKER

I think that is download mailchimp values

how can I upload name, email to mailchimp
ASKER CERTIFIED SOLUTION
Avatar of sivagnanam chandrakanth
sivagnanam chandrakanth
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

thanks for the api information