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