Mailchimp integration with php


Please Download MCAPI class from git url given below

https://github.com/ziyed/mailchimp_php_class.git

Or

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

How to use mailchimp php class and manipulate user data.


<?php 

  require_once 'MCAPI.php';

  // grab an API Key from http://admin.mailchimp.com/account/api/
  $api = new MCAPI($apiKey);

  // grab your List's Unique Id by going to http://admin.mailchimp.com/lists/
  // Click the "settings" link for the list - the Unique Id is at the bottom of that page. 
  $list_id = "58d58d54d5s";
                    
  $merge_vars = Array(                       
	'FNAME' => 'First Name'
  );

  if ($api->listSubscribe($list_id, $useremail, $merge_vars) === true) {
	// It worked!
  } else {
	// An error ocurred, return error message
  }

?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s