-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-contact.php
More file actions
49 lines (40 loc) · 1.06 KB
/
update-contact.php
File metadata and controls
49 lines (40 loc) · 1.06 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
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
$GH_CF_ClientType = "N685FozQaO10BsUx0N4M";
$fields = array(
"email" => "bikash@cleonix.com",
"phone" => "+18887324197",
"customField" => array(
$GH_CF_ClientType => "Affiliate", //Client Type
),
);
//url-ify the data for the POST
$fields_string = json_encode($fields);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://rest.gohighlevel.com/v1/contacts/6xtHGKVKAA9hl4xAcnmV',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS =>$fields_string,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer <token>'
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Error: <br>";
echo json_encode($err);
}else{
echo "Success: <br>";
$result = json_decode($response);
echo "<pre>";
print_r($result);
}
?>