i'm using the php library to add a new contact to a list..here's my code:
$username = '';
$apiKey = '';
$consumerSecret = '';
$apipass = '';
$ConstantContact = new ConstantContact("basic", $apiKey, $username, $apipass);
$Contact = new Contact();
$Contact->emailAddress = "email@example.com";
$Contact->firstName = "ftest";
$Contact->lastName = "ltest";
$Contact->lists = array('http://api.constantcontact.com/ws/customers/$username/lists/1');
$NewContact = $ConstantContact->addContact($Contact);
mail('firstname.lastname@example.org','contact not addeded','failure');
but when i run the above code, i get the error:
Catchable fatal error: Argument 2 passed to Ctct\ConstantContact::addContact() must be an instance of Ctct\Components\Contacts\Contact, none given, called in /home/masterss/public_html/projects/constantcontactapi/contact.php on line 28 and defined in /home/masterss/public_html/projects/constantcontactapi/src/Ctct/ConstantContact.php on line 153
seems to be a problem when addContact() is called..why i'm i getting the above error?..any assistance would be much appreciated
It looks like you are mixing an old and new PHP library in the code you provided.
This is the PHP SDK method to use to add or update a contact.
The v2 API does not accept the basic authentication method. In order to get an OAuth 2.0 access token (which is required for the v2 API) follow the instructions here.
View API documentation, code samples, get your API key.
We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...Read More