CURL and MailChimp (solved)

rodsdesign 07 Oct, 2010
Hi all,

If anyone has gotten the curl plugin to work with MailChimp - I'd appreciate some help.

Specifically - forming the URL and including the merge_vars... kind of lost with CURL.

I know that's not very specific - perhaps off-list?

thanks
GreyHead 08 Oct, 2010
Hi RodsDesign,

I have a free MailChimp account and see that there are some Joomla! plug-ins but don't know much more than that.

Where have you got to so far?

Bob
rodsdesign 12 Oct, 2010
Hey Bob,
thanks for your response...

I "gave up" on CURL - I need to read some tutorials🙂

I DID however get it to work in a regular Chronoform.

1. Downloaded the listsubscribe API code
2. put my APIkey in the config.inc.php
3. Here's the code - in the On Submit Code - after sending email box:


$email = $_POST[text_1];
$fname = $_POST[text_2];
$interest = $_POST[radio0];

require_once 'inc/MCAPI.class.php';
require_once 'inc/config.inc.php'; //contains apikey and ListID
$api = new MCAPI($apikey);

$merge_vars = array(FNAME=>$fname, LNAME=>'', INTERESTS=>$interest);
$retval = $api->listSubscribe( $listId, $email, $merge_vars );

if ($api->errorCode){

//echo "Unable to load listSubscribe()!\n";
//echo "\tCode=".$api->errorCode."\n";
//echo "\tMsg=".$api->errorMessage."\n";
} else {
//echo "Returned: ".$retval."\n";
}


The key was removing the apostrophes from the array declaration around FNAME etc. In the "official" API docs, the $merge_vars was:
$merge_vars = array('FNAME'=>$fname, 'LNAME'=>'', 'INTERESTS'=>$interest);

and that constantly created the error.

Hopefully - this might help others with the MailChimp integration...

Rod
This topic is locked and no more replies can be posted.