-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcontacts_update.php
More file actions
36 lines (30 loc) · 1.21 KB
/
contacts_update.php
File metadata and controls
36 lines (30 loc) · 1.21 KB
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
34
35
36
<?php
//You must pass the contact ID as an argument to indicate which contact is being updated
//Multiple contacts can be updated in a single call by wrapping the data in separate contact tags
$data = <<<STRING
<contact id="12345">
<Group_Tag name="Contact Information">
<field name="Company">Ontraport</field>
<field name="Home Phone">5555555</field>
</Group_Tag>
</contact>
<contact id="98765">
<Group_Tag name="Contact Information">
<field name="Email">test@test.com</field>
</Group_Tag>
</contact>
STRING;
$data = urlencode(urlencode($data));
// Replace the strings with your API credentials located in Admin > OfficeAutoPilot API Instructions and Key Manager
$appid = "XXXXXXXXXXXXXXX";
$key = "XXXXXXXXXXXXXXX";
$reqType= "update";
$postargs = "appid=".$appid."&key=".$key."&return_id=1&reqType=".$reqType."&data=".$data;
$request = "http://api.ontraport.com/cdata.php";
$session = curl_init($request);
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS, $postargs);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
curl_close($session);