-
Notifications
You must be signed in to change notification settings - Fork 0
/
bierfest-script.php
31 lines (25 loc) · 922 Bytes
/
bierfest-script.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
<?php
define("ACTIVECAMPAIGN_URL", "https://cervecerakunstmann.api-us1.com");
define("ACTIVECAMPAIGN_API_KEY", "[key]");
require_once("includes/ActiveCampaign.class.php");
$ac = new ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY);
$contact = array(
"email" => "[email protected]",
"name" => "Felipe Peña",
"p[7]" => 7,
"status[1]" => 1,
"field[2,0]" => "Femenino", // Valor sexo
"field[3,0]" => "Los Ríos", // Valor región
"field[6,0]" => "11.111.111-1", // Valor RUT
"field[7,0]" => "Ingeniero", // Valor ocupación
);
$contact_sync = $ac->api("contact/sync", $contact);
if (!(int)$contact_sync->success) {
// request failed
echo "<p>Error al sincronizar usuario. Error: " . $contact_sync->error . "</p>";
exit();
}
// successful request
$contact_id = (int)$contact_sync->subscriber_id;
echo "<p>Contacto actualizado y sincronizado exitosamente (ID {$contact_id})!</p>";
?>