Adding a contact

RogerB02
Consulting & Training

Adding a contact

Hi,

 

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???

 

1 REPLY 1
Shannon_W
Employee

Hi,

 

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