forked from novaksolutions/infusionsoft-php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.php
33 lines (23 loc) · 968 Bytes
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
// Include the SDK
require_once('Infusionsoft/infusionsoft.php');
$appName = 'xx123.infusionsoft.com';
$apiKey = '123xyz';
//Initiate the Infusionsoft_App with API credentials
$app = new Infusionsoft_App($appName, $apiKey);
//Add the Infusionsoft App to the AppPool class
Infusionsoft_AppPool::addApp($app);
// Create a new contact object
$contact = new Infusionsoft_Contact(78649);
//Read a field from the loaded Contact object
$firstName = $contact->FirstName;
//Change a value on the loaded Contact object and save the change to Infusionsoft
$contact->FirstName = 'Bob';
$contact->save();
/**
* Using the Infusionsoft_DataService::query method
*/
//Query using two different field criteria
$contacts = Infusionsoft_DataService::query(new Infusionsoft_Contact(), array('FirstName' => 'Bob', 'LastName' => 'Doe'));
//Querying using an IN statement
$contacts = Infusionsoft_DataService::query(new Infusionsoft_Contact(), array('Id' => array(3,5,7)));