#!/usr/bin/php <?php $globalCurlOptions = array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_BINARYTRANSFER => TRUE, CURLOPT_FRESH_CONNECT => TRUE, CURLOPT_FORBID_REUSE => TRUE, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_VERBOSE => FALSE); $result = postToSonoSite("*****@*****.**"); print_r($result); // ========================================================================= /** POST data to the Contact Sales form * Provide email address * return timestamp (passed as postal_code) * and any errors */ function postToSonoSite($email) { global $globalCurlOptions; $errors = array(); $url = "https://www.sonosite.com/sales/contact"; // POST test data to the Contact Sales form $successTag = "<title>Thank You! | SonoSite</title>"; // postal_code is our timestamp // Form is MMddHHmm 07291330 is July 29, 1:30pm $timestamp = date("mdHi"); $data = array("firstname" => "Webmaster", "lastname" => "Tester", "email" => $email, "country" => "aq", "postal_code" => $timestamp, "phone" => "425-951-1200", "specialty" => "Anesthesiology", "comments" => "Eloqua Heartbeat", "form_build_id" => "form-7e53546357d05cd6428c89990344bce8", "form_id" => "sonosite_contactus_newsalesform", "elqCampaignID" => "9999"); $ch = curl_init(); $headers = array("Content-Type: application/x-www-form-urlencoded"); curl_setopt_array($ch, $globalCurlOptions); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); // Check for errors and display the error message if ($errno = curl_errno($ch)) {
#!/usr/bin/php <?php $recipients = "charles.jackson@sonosite.com, nightbeacons@gmail.com"; $emailAddress = "*****@*****.**"; $globalCurlOptions = array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_BINARYTRANSFER => TRUE, CURLOPT_FRESH_CONNECT => TRUE, CURLOPT_FORBID_REUSE => TRUE, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_CONNECTTIMEOUT => 25, CURLOPT_VERBOSE => FALSE); $mailHeaders = 'From: webmaster@sonosite.com' . "\r\n" . 'Reply-To: webmaster@sonosite.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); // Post a sample set of data through the SonoSite "Contact Sales" form $postResult = postToSonoSite($emailAddress); $timestamp = $postResult['timestamp']; // Check Eloqua Form Submission Data for the timestamp (aka postal_code) and email addr $tries = $result = 0; while ($tries < 3 and $result == 0) { sleep(15); // echo "Tries = $tries... result=$result\n"; $eloquaAry = checkForPost($emailAddress, $timestamp); $result = $eloquaAry['found']; $tries++; } $msg = ""; // Send a health check email during the 6am hour if (date("G") != 6) { if ($postResult['errors']['post'] == "OK" and $result == 1) { $subject = "Eloqua Correctly Receiving Leads"; $msg = "A test lead was submitted to the Contact Sales form, and it was received by Eloqua."; } } if ($result == 0 or $postResult['errors']['post'] != "OK") { $subject = "ERROR: Eloqua NOT Receiving Leads"; $msg = "Data submitted to the Contact Sales form was not received by Eloqua.\r\n Details:\r\n"; if ($postResult['errors']['post'] == "OK") { $msg .= " Data was successfully POSTed to the Contact Sales form.\r\n";