GithubHelp home page GithubHelp logo

image-watermark's Introduction

iContact API

Super-simple, minimum abstraction iContact API v2 wrapper, in PHP.

Requires PHP 5.3 and a pulse.

Installation

You can install the mailchimp-api using Composer:

composer require mizanur/icontact-api-php

Examples

use this on top of your class:

use iContact\iContactApi;

// Give the API your information iContactApi::getInstance()->setConfig(array( 'appId' => '', 'apiPassword' => '', 'apiUsername' => '' ));

// Store the singleton

$oiContact = iContactApi::getInstance();

// Try to make the call(s)

try { // are examples on how to call the iContact PHP API class // Grab all contacts var_dump($oiContact->getContacts()); // Grab a contact var_dump($oiContact->getContact(42094396)); // Create a contact var_dump($oiContact->addContact('[email protected]', null, null, 'Joe', 'Shmoe', null, '123 Somewhere Ln', 'Apt 12', 'Somewhere', 'NW', '12345', '123-456-7890', '123-456-7890', null)); // Get messages var_dump($oiContact->getMessages()); // Create a list var_dump($oiContact->addList('somelist', 1698, true, false, false, 'Just an example list', 'Some List')); // Subscribe contact to list var_dump($oiContact->subscribeContactToList(42094396, 179962, 'normal')); // Grab all campaigns var_dump($oiContact->getCampaigns()); // Create message var_dump($oiContact->addMessage('An Example Message', 585, '

An Example Message

', 'An Example Message', 'ExampleMessage', 33765, 'normal')); // Schedule send var_dump($oiContact->sendMessage(array(33765), 179962, null, null, null, mktime(12, 0, 0, 1, 1, 2012))); // Upload data by sending a filename (execute a PUT based on file contents) var_dump($oiContact->uploadData('/path/to/file.csv', 179962)); // Upload data by sending a string of file contents $sFileData = file_get_contents('/path/to/file.csv'); // Read the file var_dump($oiContact->uploadData($sFileData, 179962)); // Send the data to the API } catch (Exception $oException) { // Catch any exceptions // Dump errors var_dump($oiContact->getErrors()); // Grab the last raw request data var_dump($oiContact->getLastRequest()); // Grab the last raw response data var_dump($oiContact->getLastResponse()); }

Note for contributors: This is not Code Golf.

image-watermark's People

Contributors

mizan3008 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.