tr class=results and td class=row $htmltemplate = 'https://lifeinsurancemarketcenter.com/results/'; // Name of the HTML template used to display quote results // Template accepts the following place holders: /** * * %email% - agent eMail * %web% - agent web URL * %face% - face amount of quote * %benefit% - benefit type (level, limited, graded, guaranteed, siwl) * %gender% - insured gender * %dob% - insured DOB * %birthday% - insured birthday * %age% - insured age * %tobacco% - tobacco use * %state% - insured state * **/ $agent_logo = ' '; # optional - may be left blank but why :) // URL for your logo (gif, jpg, png). // Suggested size not to exceed 400x100. // If left blank, the default FEX Quotes logo will be used in your template. $lead_capture = '2'; # options are '1' or '2' // There are two supported lead capture methods: // lead_capture = 1: Default method that utilizes the FEX lead capture and CRM systems // lead_capture = 2: Utilize your own lead form $lead_capture_button = 'red'; // Enter color for lead capture button. // This feature only works with the supplied template CSS (fex_results.htm) // Valid options are: blue, red, orange, gray, mediumgray, darkgray $lead_capture_anchor = 'Application'; // Enter text for the lead capture link. $lead_url = '#'; # optional - may be left blank // Optional setting. Only to be completed if lead_capture = 2 // If lead_capture variable above is set to '2', then you *MUST* enter the URL for *YOUR* lead form // EXAMPLE: your_lead_script.php?face=%face%&state=%state%&tobacco=%tobacco%&dob=%dob%&gender=%gender%&company=%co_short_name%&ann=%annual%&mon=%monthly%"; // lead url supports same place holders as the html template with the addition of: /** * * %co_long_name% - company name * %logo% - company logo name * **/ ############################################################################################ ## No editing required beyond this point. No support provided for edited scripts. ############################################################################################ // create our variables from the form $state = $_POST['state']; $bmonth = $_POST['bmonth']; $bday = $_POST['bday']; $byear = $_POST['byear']; $sex = $_POST['sex']; $tobacco = $_POST['tobacco']; $amount = $_POST['amount']; $input_amount = $_POST['input_amount']; $plantype = $_POST['plantype']; // convert direct face amount input $input_amount = preg_replace('/[^0-9]/s', '', $input_amount); $input_amount = ($input_amount / 1000); if ($input_amount > 0) { $amount = $input_amount; } // create array of data to post back to FEX $post_data = array('accesskey' => $accesskey, 'state' => $state, 'bmonth' => $bmonth, 'bday' => $bday, 'byear' => $byear, 'sex' => $sex, 'tobacco' => $tobacco, 'amount' => $amount, 'plantype' => $plantype ); // create the final data string to be posted $post_string = http_build_query($post_data); // create cURL connection $curl_connection = curl_init('http://fexquotes.com/api/f/agent/?'); // set cURL options curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl_connection, CURLOPT_USERAGENT, "FEX API"); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true); // set data to be posted curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string); // perform our request $result = curl_exec($curl_connection); // close the connection curl_close($curl_connection); // Raw data or not if (empty($mode)) { header('Content-type: application/xml'); echo $result; exit; } $xml = simplexml_load_string($result); // error trap $error = $xml->error; if ($error) { die($error); } // parse out agent_profile node $web_id = $xml->subscriber_profile[0]->web_id; $email = $xml->subscriber_profile[0]->email; $web = $xml->subscriber_profile[0]->web; // determine logo if (empty($agent_logo)) { $agent_logo = "http://www.insurcenter.com/wp-content/uploads/bfi_thumb/Insurance-Center-RGB-NoCareValue-R-1-e1494512812741-n8defeuy5bq58sxejn1r8s68ja7irtlozm6rq6r85c.png"; } // parse out insured_data node $face = $xml->insured_data[0]->face; $benefit = $xml->insured_data[0]->benefit; $gender = $xml->insured_data[0]->gender; $dob = $xml->insured_data[0]->dob; $birthday = $xml->insured_data[0]->birthday; $age = $xml->insured_data[0]->age; $tobacco = $xml->insured_data[0]->tobacco; $state = $xml->insured_data[0]->state; // parse out results count $count = $xml->results[0]->count; // initialize results array $results = array(); // parse out results node for ($i = 0; $i < count($xml->results->company); $i++) { $data = $xml->results->company[$i]; $long_name = $data->company_name; $image = $data->image; $annual = $data->annual; $monthly = $data->monthly; $plan_name = $data->plan_name; // lead form if ($lead_capture == 1) { $x_imgstring = pathinfo($image); $logo_name = $x_imgstring['filename']; $lead_url = "http://fexquotes.com/rmt/contact/quote_contact.pl?f=1&agt=%web_id%&fa=%face%&s=%state%&t=%tobacco%&dob=%dob%&g=%gender%&co=%co_short_name%&logo=%logo_name%&a=%annual%&m=%monthly%"; } $lead_form = "$lead_capture_anchor"; $contact_form = "Contact"; $srch_frm = array('%state%', '%face%', '%benefit%', '%gender%', '%dob%', '%birthday%', '%age%', '%tobacco%', '%co_long_name%', '%co_short_name%', '%logo_name%', '%annual%', '%monthly%', '%web_id%', '%email%', '%web%'); $rplc_frm = array($state, $face, $benefit, $gender, $dob, $birthday, $age, $tobacco, $long_name, $short_name, $logo_name, $annual, $monthly, $web_id, $email, $web); $lead_form = str_replace($srch_frm, $rplc_frm, $lead_form); // display preferences if ($display == 'text') { $format = "$long_name
$plan_name
"; } if ($display == 'graphic') { $format = "
$plan_name
"; } // account for non-rated modals $annual_rate = "\$$annual"; if ( $annual == '') { $annual_rate = "Not Calculated"; } $monthly_rate = "\$$monthly"; if ( $monthly == '') { $monthly_rate = "Not Calculated"; } // populate results array in web table format array_push($results, " $format $annual_rate Annually $monthly_rate Monthly $contact_form "); } // convert results to string variable to be used in template if ($count <= 0) { $count_lang = "No Plans Found"; $results_string = "
No Results Found.

Go Back
"; } /* if ($count == 1) { $count_lang = "$count Plan Found"; $results_string = implode ("\n", $results); }*/ if ($count > 1) { $count_lang = "$count Plans Found"; $results_string = implode ("\n", $results); } // grab the template $template = file_get_contents($htmltemplate); // Format benefit types if(strtolower($benefit) == 'guaranteed'){ $benefit = "Guaranteed Issue"; } if(strtolower($benefit) == 'siwl'){ $benefit = "SIWL"; } if(strtolower($benefit) == 'limited'){ $benefit = "Limited Pay"; } if(strtolower($benefit) == 'graded'){ $benefit = "Graded / Modified"; } // search and replace variables and placeholders $search = array('%state%', '%face%', '%benefit%', '%gender%', '%dob%', '%birthday%', '%age%', '%tobacco%', '%email%', '%web%', '%logo%', '%lead_form%', '%count%', '%results%'); $replace = array($state, $face, $benefit, $gender, $dob, $birthday, $age, $tobacco, $email, $web, $agent_logo, $lead_form, $count_lang, $results_string); $output = str_replace($search, $replace, $template); // showtime print "$output"; ?>