Merged in feature/MAW-886-forbes-host-and-post (pull request #46)
Feature/MAW-886 forbes host and post * MAW-886: Forbes Host and Post
This commit is contained in:
101
wp/ForbesHealth.php
Normal file
101
wp/ForbesHealth.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
function postFiveNine()
|
||||
{
|
||||
$Campaign_ID = '701Ho000001GIKJ';
|
||||
date_default_timezone_set('America/New_York');
|
||||
$F9Date = date("Y-m-d")."-". date("H:i");
|
||||
$F9domain = "connect america";
|
||||
$FORM_ID = ($_POST['form_ID']);
|
||||
|
||||
if($FORM_ID == 'ForbesHealth') {
|
||||
$F9list = "Web Form Submissions H";
|
||||
} else {
|
||||
$F9list = "";
|
||||
}
|
||||
|
||||
$newphone = preg_replace('/^1|\D/', '', $_POST['phone']);
|
||||
|
||||
$cleanPOST = array(
|
||||
'first_name' => ($_POST['first-name']),
|
||||
'last_name' => ($_POST['last-name']),
|
||||
'number1' => $newphone,
|
||||
'F9domain' => $F9domain,
|
||||
'F9list' => $F9list,
|
||||
'salesforce_id' => $Campaign_ID,
|
||||
'Device_6' => $title,
|
||||
'WebDialer_Key' => $F9Date,
|
||||
'F9key' => WebDialer_Key,
|
||||
'F9CallASAP' => true
|
||||
);
|
||||
|
||||
foreach ($cleanPOST as $key=>$value){
|
||||
$cleanPOST[stripslashes($key)] = stripslashes($value);
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
// DEBUG - this should return a message to the user it failed
|
||||
if (curl_error($ch) != "") {
|
||||
echo "Error: $error\n";
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, "https://api.five9.com/web2campaign/AddToList");
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
function postSalesforce()
|
||||
|
||||
{
|
||||
$oid = "00D1I000000mJ0Q";
|
||||
$member_status = "Web response";
|
||||
$lead_source = "Web";
|
||||
$FORM_ID = ($_POST['form_ID']);
|
||||
|
||||
if($FORM_ID == 'ForbesHealth') {
|
||||
$Campaign_ID = "701Ho000001GIKJ";
|
||||
} else {
|
||||
$Campaign_ID = "";
|
||||
}
|
||||
|
||||
|
||||
$cleanPOST = array(
|
||||
'first_name' => ($_POST['first-name']),
|
||||
'last_name' => ($_POST['last-name']),
|
||||
'phone' => ($_POST['phone']),
|
||||
'email' => ($_POST['your-email']),
|
||||
//'street' => ($_POST['street']),
|
||||
//'city' => ($_POST['city']),
|
||||
//'state' => ($_POST['state']),
|
||||
'zip' => ($_POST['zip']),
|
||||
'Campaign_ID' => $Campaign_ID,
|
||||
'oid' => $oid,
|
||||
'lead_source' => $lead_source,
|
||||
'Custom_Field_1__c' => ($_POST['subid1']),
|
||||
'Custom_Field_2__c' => ($_POST['subid2']),
|
||||
'Custom_Field_3__c' => ($_POST['subid3']),
|
||||
'Custom_Field_4__c' => ($_POST['subid4'])
|
||||
);
|
||||
|
||||
foreach ($cleanPOST as $key=>$value){
|
||||
$cleanPOST[stripslashes($key)] = stripslashes($value);
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
if (curl_error($ch) != "") {
|
||||
exit( "Error: $error\n");
|
||||
}
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, "https://webto.salesforce.com/servlet/servlet.WebToLead");
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST));
|
||||
curl_exec($ch);
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
postSalesforce();
|
||||
//postFiveNine();
|
||||
Reference in New Issue
Block a user