Example #1
0
    $_SESSION['appt_time'] = $_POST['appt_time'];
    $_SESSION['interest'] = $interest;
} else {
    $appt_time_formated = '';
}
$submitToESM = $submitToESM && (!isset($_POST['submitToVelocify']) || strtolower($_POST['submitToVelocify']) != 'no');
if ($submitToESM) {
    if ($is_update) {
        $leadString = "<leadsDocument action=\"UpdateFromPURL\">" . "<campaignName>SynergisEducation</campaignName>" . "<leads>" . "<lead>" . "<InstitutionName>" . $division . "</InstitutionName>" . "<VelocifyLeadId>" . $lead_id . "</VelocifyLeadId>" . "<PhoneNumber><![CDATA[" . $phone . "]]></PhoneNumber>" . "<Reactivation>Phone Update</Reactivation>" . "</lead>" . "</leads>" . "</leadsDocument>";
    } else {
        $leadString = "<leadsDocument>" . "<campaignName>SynergisEducation</campaignName>" . "<leads>" . "<lead>" . "<InstitutionName>" . $division . "</InstitutionName>" . "<CampusLocation>" . $campus . "</CampusLocation>" . "<ClientID>" . $guid . "</ClientID>" . "<InquiryDate>" . $timeStamp . "</InquiryDate>" . "<FirstName><![CDATA[" . $first . "]]></FirstName>" . "<LastName><![CDATA[" . $last . "]]></LastName>" . "<ProgramOfInterest><![CDATA[" . $interest . "]]></ProgramOfInterest>" . "<PhoneNumber><![CDATA[" . $phone . "]]></PhoneNumber>" . "<Address1><![CDATA[" . $address . "]]></Address1>" . "<City><![CDATA[" . $city . "]]></City>" . "<State>" . $state . "</State>" . "<Zip><![CDATA[" . $zip . "]]></Zip>" . "<Country>" . $country . "</Country>" . "<Email><![CDATA[" . $email . "]]></Email>" . "<LeadType>" . $type . "</LeadType>" . "<LeadChannel>" . $channel . "</LeadChannel>" . "<LeadVendor>" . $vendor . "</LeadVendor>" . "<LeadCampaign>" . $campaign . "</LeadCampaign>" . "<TextOptIn>0</TextOptIn>" . "<ImportMethod>XML</ImportMethod>" . "<ConsentFlag>Yes</ConsentFlag>" . "<ReferredBy><![CDATA[" . $referrer . "]]></ReferredBy>" . "<ReferredByCategory>" . $referredByCategory . "</ReferredByCategory>" . "<Employer><![CDATA[" . (isset($_POST['employer']) ? $_POST['employer'] : '') . "]]></Employer>" . "<DPDEmail>" . (isset($_POST['dpd_synergis_email']) ? $_POST['dpd_synergis_email'] : '') . "</DPDEmail>" . "<HowDidYouHearAboutUs>" . $howDidYouHear . "</HowDidYouHearAboutUs>" . "<Notes><![CDATA[" . $notes . "]]></Notes>" . "<Appointment>" . $appt_time_formated . "</Appointment>" . "<MostRecentInstitution><![CDATA[" . (empty($hsName) ? isset($_POST['institution']) ? $_POST['institution'] : '' : $hsName) . "]]></MostRecentInstitution>" . "<HSGradYear><![CDATA[" . $hsYear . "]]></HSGradYear>" . "<HighestEDULevel>" . (isset($_POST['levelofeducation']) ? $_POST['levelofeducation'] : '') . "</HighestEDULevel>" . "<Age><![CDATA[" . (isset($_POST['age']) ? $_POST['age'] : '') . "]]></Age>" . "<CurrentProfession><![CDATA[" . (isset($_POST['profession']) ? $_POST['profession'] : '') . "]]></CurrentProfession>" . "<Employer><![CDATA[" . (isset($_POST['employer']) ? $_POST['employer'] : '') . "]]></Employer>" . "<Income><![CDATA[" . (isset($_POST['income']) ? $_POST['income'] : '') . "]]></Income>" . "<EducationGoal><![CDATA[" . (isset($_POST['educationgoal']) ? $_POST['educationgoal'] : '') . "]]></EducationGoal>" . "<Concentration><![CDATA[" . (isset($_POST['concentration']) ? $_POST['concentration'] : '') . "]]></Concentration>" . "</lead>" . "</leads>" . "</leadsDocument>";
    }
    $error = 0;
    $soapClient = new SoapClient($soapURL);
    try {
        $info = $soapClient->UploadLeads(array("sleadsDocument" => $leadString));
    } catch (SoapFault $fault) {
        $error = 1;
        $errorMessage = "SOAP Fault Code: " . $fault->getCode() . "\n\tMessage: " . $fault->getMessage();
    }
    if ($error == 0) {
        $result = $info->UploadLeadsResult;
    } else {
        // Kill the link to Soap
        unset($soapClient);
    }
}
// send notification of lead reception
if ($submitToESM) {
    $emailContent = '';
    foreach ($_POST as $name => $value) {