This repository has been archived by the owner on Dec 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Contacts
rdaviscc edited this page Sep 29, 2011
·
9 revisions
<?php
//Get potential contact lists
$lists = $ConstantContact->getLists();
$contactObj = new Contact();
$contactObj->lists = array($lists['lists'][0]->id, $lists['lists'][1]->id);
$contactObj->emailAddress = 'example@example.com';
// Create the contact
$Contact = $ConstantContact->addContact($contactObj);
?>
<?php
// Get the first page of contacts
$Contacts = $ConstantContact->getContacts();
// Get a second page of contacts
$moreContacts = $ConstantContact->getContacts($Contacts['nextLink']);
?>
<?php
// Search for a single contact
$Contact = $ConstantContact->searchContactsByEmail('example@example.com');
// Search for multiple contacts (up to 50)
$contacts = $ConstantContact->searchContactsByEmail(array('ex1@example.com', 'ex2@example.com'));
?>
<?php
// Search for a contact by Email Address
$search = $ConstantContact->searchContactsByEmail('example@example.com');
// Get details for the Contact
$Contact = $ConstantContact->getContactDetails($search[0]);
?>
<?php
// Search for a contact by Email Address
$search = $ConstantContact->searchContactsByEmail('example@example.com');
// Get details for the Contact
$Contact = $ConstantContact->getContactDetails($search[0]);
// modify Contact properties
$Contact->firstName = "John";
$Contact->lastName = "Doe";
//update the contact
$Contact = $ConstantContact->updateContact($Contact);
?>
###Delete a Contact
<?php
// Get a page of contacts
$contacts = $ConstantContact->getContacts();
// Delete the first contact returned
$delete = $ConstantContact->deleteContact($contacts['contacts'][0]);
?>