-
Notifications
You must be signed in to change notification settings - Fork 3
/
signup.php
124 lines (106 loc) · 3.11 KB
/
signup.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
require('src/LassoLead.php');
require('src/RegistrantSubmitter.php');
/*
* These variables should only be attached to the request on the server side
*/
$clientId = '';
$projectId = '';
/*
* This is a security token and should be kept private and should not be a
* hidden field on your registration page
*/
$apiKey = '';
if (empty($clientId) || empty($projectId) || empty($apiKey)) {
throw new Exception('Required parameters are not set, please
check that your $clientId, $projectId and $apiKey are
configured correctly');
}
/*
* Constructing and submitting a lead:
* Map your forms fields into the lead object and submit
*/
$lead = new LassoLead($_REQUEST['firstName'],
$_REQUEST['lastName'],
$projectId,
$clientId);
$lead->addEmail($_REQUEST['email']);
$lead->addPhone($_REQUEST['phone']);
$lead->addAddress($_REQUEST['address'],
$_REQUEST['city'],
$_REQUEST['province'],
$_REQUEST['postal'],
$_REQUEST['country']);
$lead->sendAssignmentNotification();
/**
* Notes
*
* Added during submission by using the following
*
* $lead->addNote("I would like this comment recorded");
*/
/**
* Rating
*
* Submitted as a string or using the ratingId
*
* $lead->setRating('N');
*
* $lead->setRatingId(1);
*/
/**
* Website Tracking
*
* Associated with the submission as follows
* tracking must be installed on the site and the value from the tracking
* javascript LassoCRM.tracker.readCookie("ut");
*
* $lead->setWebsiteTracking("LAS-130457-02", "8FD6985D-D82C-4D4A-AF21-69989C933959");
*/
/**
* Questions
*
* Submitted either using string or ids
*
* Passing in a folder path will create the question if it does not exist. Note
* that if the folder is moved in Lasso it will recreate it if the submissions
* path is not updated as well
*
* $lead->addQuestion('\TheProject\Registration', 'How Heard', 'Newsletter');
*
* Questions can be answered by Id by setting questionId and answerId or Ids
* $lead->answerQuestionById(2, [5,6]);
* $lead->answerQuestionById(1, 2);
*
* Free form text questions can be answered by passing the questionId and an answer string
* $lead->answerQuestionByIdForText($questionId, $answerText);
*/
/**
* Auto Replay Emails
*
* The auto reply email content can be specified by passing in a templateId
* with the submission.
*
* $lead->sendAutoReplyThankYouEmail($templateId);
*/
/**
* Sales Rep Rotation
*
* By passing in a rotationId a specific group of sales people can be assigned
* the registrants that are submitted
*
* $lead->setRotationId($rotationId);
*/
$submitter = new RegistrantSubmitter();
$curl = $submitter->submit('https://api.lassocrm.com/registrants', $lead, $apiKey);
/*
* ---------------------------------------------------------------
* Troubleshooting examples
* ---------------------------------------------------------------
*/
/* Viewing the submission body */
//echo json_encode($lead->toArray());
/* Getting the response servers response code */
//echo curl_getinfo($curl, CURLINFO_HTTP_CODE);
/* Getting all details of the cUrl request */
//print_r(curl_getinfo($curl));