Main menu
WalkswithMeAPIiContact API with PHP

iContact API with PHP

Welcome back to iContact API with PHP using iContact api 2.2 provides a wide range of API call for our requirement.In my previous post I am already explained the basic operations in iContact API with php.How to move subscription between list and adding news list etc. Here I am just explaining some new custom functions or methods that will help us to use iContact api with php more user friendly.

iContact integration using php api

iContact integration using php api

If you have any doubt on basic operation of iContact API with PHP please check my previous post. Here we can start with new methods for iContact api with php. First method is help you to find an iContact account details with email, the search options allows you to find the iContact details with email. First include the basic library files and set the credentials.

$oiContact = iContactApi::getInstance();
$oiContact->setAccountId(ACC_ID);/// Account Id
$oiContact->setClientFolderId(CLIENT_ID);/// Client folder Id

The iContact API with PHP using email search as follows.

$res = $oiContact->getContactWithEmail("");
echo "<pre/>";

In your library file you have to include the method for iContact API with PHP.

public function getContactWithEmail($Email) {
// Make the call and return the data
$this->aSearchParameters['status'] = 'total';
$this->aSearchParameters['email'] = $Email;
//$this->aSearchParameters['mytermSearchType'] = 'eq';
return $this->makeCall("/a/{$this->setAccountId()}/c/{$this->setClientFolderId()}/contacts", 'GET', null, 'contacts');

Another new function is created for iContact API with PHP is You can check subscription details of a contact with its Id, ie you will get all the subscription list with contact id in iContact . The method usage is as follows.

$res = $oiContact->CheckingSubscriptionWithContactId(CONTACT_ID);
echo "<pre/>";

And in your library file you have to include new method as.

public function CheckingSubscriptionWithContactId($contactId) {
// Make the call and return the lists
return $this->makeCall("/a/{$this->setAccountId()}/c/{$this->setClientFolderId()}/subscriptions?status=total&contactId={$contactId}", 'GET', null, 'subscriptions');

The next method is used to check a contact exists in a list or not. You can check a contact that exists on a list with contact id and list id with following function.

$res = $oiContact->CheckingContactWithListId(CONTACT_ID,LIST_ID);
echo "<pre/>";

In your iContact API with PHP library have the following method.

public function CheckingContactWithListId($contactId,$listId) {
// Make the call and return the data
return $this->makeCall("/a/{$this->setAccountId()}/c/{$this->setClientFolderId()}/contacts?status=total&listId={$listId}&contactId={$contactId}", 'GET');

I hope someone will find this and solve their challenges in programming. Enjoy iContact API with PHP. :):):)

One thought on “iContact API with PHP

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>