From 9c30c7c8fdaeb9deca1d7f62b19c7ba3fb54ac89 Mon Sep 17 00:00:00 2001 From: SRIRAM RAO TAKKALLAPELLY Date: Tue, 2 Apr 2024 22:26:23 +0000 Subject: [PATCH] Merged in feature/MAW-888-schemathics-host-and-post (pull request #47) MAW-888: Schemathics Host and Post --- wp/Schemathics.php | 101 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 wp/Schemathics.php diff --git a/wp/Schemathics.php b/wp/Schemathics.php new file mode 100644 index 00000000..af1b37ca --- /dev/null +++ b/wp/Schemathics.php @@ -0,0 +1,101 @@ + ($_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 == 'Schemathics') { + $Campaign_ID = "701Ho000001GX0h"; + } 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(); \ No newline at end of file