php - NetworkError: 500 Internal Server Error - Mailchimp API -
i'm trying add email list using mailchimp api. i'm using code
// add user mailchimp newsletter list function addtomailchimp($email,$fname,$lname){ require_once(get_stylesheet_directory().'/assets/mailchimp.php'); $apikey = '"xxxxxxxxxx-us7"'; $list_id ="7xxxxxxxe"; $mailchimp = new mailchimp($apikey); $result = $mailchimp->call('lists/subscribe', array( 'id' => $list_id, 'email' => array('email'=>$email), 'merge_vars' => array('fname'=>$fname, 'lname'=>$lname), 'double_optin' => false, 'update_existing' => true, 'replace_interests' => false, 'send_welcome' => false, )); die(var_dump($result)); }
it return error:
networkerror: 500 internal server error -
i don't know how tackle issue
i'll appreciate help
edit: see comment,
$apikey = '"xxxxxxxxxx-us7"';
has single , double quotes around leading incorrect api key causing server unable authenticate , returning 500.
Comments
Post a Comment