public function submit($location, LassoLead $lead, $apiKey)
 {
     //open connection
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_POST, true);
     curl_setopt($curl, CURLOPT_HEADER, 'application/json');
     curl_setopt($curl, CURLOPT_URL, $location);
     curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($lead->toArray()));
     curl_setopt($curl, CURLOPT_HTTPHEADER, array('X-Lasso-Auth:' . 'Token=' . $apiKey . ',Version=1.0'));
     curl_exec($curl);
     return $curl;
 }
$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->setRating('N');
$lead->sendAssignmentNotification();
$lead->addQuestion('\\TheProject\\Registration', 'How Heard', 'Newsletter');
$submitter = new RegistrantSubmitter();
$curl = $submitter->submit('https://api.lassocrm.com/registrants', $lead, $apiKey);
/*
 * ---------------------------------------------------------------
 * Troubleshooting examples
 * ---------------------------------------------------------------
 */
/* Viewing the submission body */
//echo json_encode($lead->toArray());