We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Adding a contact

Consulting & Training

Adding a contact



I am trying to add contacts via the API, using the PHP wrapper class - with no luck so far.  My code is as follows:


include "cc_class.php";
$ccContactOBJ = new CC_Contact();


$postFields = array();
$postFields["email_address"] = $strEmail;

$postFields["lists"] = 50;

$contactXML = $ccContactOBJ->createContactXML(null,$postFields);


if (!$ccContactOBJ->addSubscriber($contactXML)) {
       $error = true;
  } else {
        $error = false;
        $_POST = array();


When I echo the XML being generated from createContactXML() it appears that it's not adding anything from the lists variable to the XML.


Where am I going wrong here???





In my email reply back to your email, I gave you some different code to use with our main PHP wrapper (what I use), but if you'd like to use this wrapper, can you post the XML that is generated with this code, with your username redacted?  You are trying to add email addresses to list 50 with this code, correct?


Best Regards,

Shannon W.

API Support Specialist

Developer Portal

View API documentation, code samples, get your API key.

Visit Page