Current Path : /home/church/public_html/comparefloridarates.com/ |
Current File : /home/church/public_html/comparefloridarates.com/success.php |
<?php include("data.php");?> <?php include("Emailer_Captcha.php"); ?> <?php $pagePhoto="slider_1.jpg"; $page_title='Successful Post | Lakeland, Florida | Compare Florida Rates'; $sub_page_title='Premiums Output'; $pagePicture=""; $pageMetaKeyword=""; //Page Keyword List $pageMetaDescription=""; //Page Meta Description List ?> <?php include("header.php");?> <div class="hero-aboutus"> <div class="container"> <div class="row"> <div class="col-xl-12 col-md-12"> <div class="main-content"> <h1><u>Success! Please view your rate quotes below!</u></h1> <table> <thead> <tr> <th>Carrier</th> <th>Premium</th> </tr> </thead> <tbody> <?php $allowed_carriers = array(); $allowed_carriers[] = 'tower hill omega'; $allowed_carriers[] = 'tower hill select'; $allowed_carriers[] = 'gulfstream'; $allowed_carriers[] = 'olympus'; $allowed_carriers[] = 'safe harbor'; $allowed_carriers[] = 'cypress'; $allowed_carriers[] = 'tower hill preferred'; $allowed_carriers[] = 'universal p&c'; $allowed_carriers[] = 'florida family'; $allowed_carriers[] = 'federated national'; $allowed_carriers[] = 'tower hill signature'; $allowed_carriers[] = 'ark royal'; $allowed_carriers[] = 'st johns'; $allowed_carriers[] = 'asi preferred'; $allowed_carriers[] = 'security first'; $allowed_carriers[] = 'citizens'; # Only show results if page was called with a POST (from the input form) if( 'POST' == $_SERVER['REQUEST_METHOD'] ){ # Function that will be used to sort the results by premium price function sort_by_rate($a, $b) { if ($a['premium'] == $b['premium']) { return 0; } return ($a['premium'] < $b['premium']) ? -1 : 1; }; # Map each input into an array $postdata = http_build_query( array( 'api_key' => "6f3I3c4WJ9fQ11e38ffd78LV22tc9a66", 'zip' => $_POST["zip"], 'cov_a' => $_POST["cov_a"], 'year_built' => $_POST["year_built"], 'construction_type' => $_POST["construction_type"] ) ); //var_dump($postdata); # Compose HTTP POST request $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); # Place POST request $json_string = file_get_contents('https://rate.honestpolicy.com/v2/get_rates', false, $context); # Parse resulting JSON //var_dump($http_response_header); //var_dump($json_string); $decoded_json = json_decode($json_string, true); if($decoded_json['rates']) { # Sort the results by premium price $rates = $decoded_json['rates']; usort($rates, "sort_by_rate"); # Produce one table row per carrier/rate foreach ($rates as $rate) { if ( in_array( strtolower($rate['company']), $allowed_carriers ) ) { echo '<tr><td>'; echo $rate['company']; echo '</td><td style="text-align: right;">$'; echo $rate['premium']; echo '</tr></td>'; } } } else { # Show error messages echo '<tr><td colspan="2">'; echo $json_string; echo '</td></tr>'; } } ?> <?php $data = '<?xml version="1.0" encoding="UTF-8"?> <ACORD> <SignonRq> <ClientDt>' . date('Y-m-dTH:i:s') . '</ClientDt> <CustLangPref>en-US</CustLangPref> <ClientApp> <Org>Headley Insurance</Org> <Name>SEMCAT</Name> <Version>0.0.0</Version> </ClientApp> </SignonRq> <InsuranceSvcRq> <RqUID>a548e9c0-05db-11df-8a39-0800200c9a66</RqUID> <HomePolicyQuoteInqRq> <RqUID>a548e9c0-05db-11df-8a39-0800200c9a66</RqUID> <TransactionRequestDt>' . date('Y-m-dTH:i:s') . '</TransactionRequestDt> <CurCd>USD</CurCd> <Producer> <GeneralPartyInfo> <NameInfo> <PersonName> <Surname>Headley</Surname> <GivenName>Scott</GivenName> </PersonName> </NameInfo> </GeneralPartyInfo> </Producer> <InsuredOrPrincipal> <GeneralPartyInfo> <NameInfo> <PersonName> <Surname>' . $_POST['lastname'] . '</Surname> <GivenName>' . $_POST['firstname'] . '</GivenName> </PersonName> </NameInfo> <Addr id="A001"> <AddrTypeCd>StreetAddress</AddrTypeCd> <Addr1>' . $_POST['address'] . '</Addr1> <City>' . $_POST['city'] . '</City> <StateProvCd>' . $_POST['state'] . '</StateProvCd> <PostalCode>' . $_POST['zip'] . '</PostalCode> </Addr> <Communications> <PhoneInfo> <CommunicationUseCd>Home</CommunicationUseCd> <PhoneNumber>' . $_POST['phone'] . '</PhoneNumber> </PhoneInfo> <EmailInfo> <EmailAddr>' . $_POST['email'] . '</EmailAddr> </EmailInfo> </Communications> </GeneralPartyInfo> </InsuredOrPrincipal> <PersPolicy> <LOBCd>HOME</LOBCd> <PersApplicationInfo> <InsuredOrPrincipal> <GeneralPartyInfo> <Addr> <AddrTypeCd>MailingAddress</AddrTypeCd> <Addr1>' . $_POST['address'] . '</Addr1> <City>' . $_POST['city'] . '</City> <StateProvCd>' . $_POST['state'] . '</StateProvCd> <PostalCode>' . $_POST['zip'] . '</PostalCode> </Addr> <Addr> <AddrTypeCd>StreetAddress</AddrTypeCd> <Addr1>' . $_POST['address'] . '</Addr1> <City>' . $_POST['city'] . '</City> <StateProvCd>' . $_POST['state'] . '</StateProvCd> <PostalCode>' . $_POST['zip'] . '</PostalCode> </Addr> </GeneralPartyInfo> </InsuredOrPrincipal> </PersApplicationInfo> </PersPolicy> <Location> <Addr> <AddrTypeCd>PhysicalRisk</AddrTypeCd> <Addr1>' . $_POST['address'] . '</Addr1> <City>' . $_POST['city'] . '</City> <StateProvCd>' . $_POST['state'] . '</StateProvCd> <PostalCode>' . $_POST['zip'] . '</PostalCode> </Addr> </Location> </HomePolicyQuoteInqRq> </InsuranceSvcRq> </ACORD>'; //echo $data; # Only show results if page was called with a POST (from the input form) if( 'POST' == $_SERVER['REQUEST_METHOD'] ){ # Map each input into an array //'api_key' => "6f3I3c4WJ9fQ11e38ffd78LV22tc9a66", $postdata = http_build_query( array( 'service' => "headleyinsuranceagency", 'box' => "083556", 'api_key' => "kFZ0q1N36NVbZrvOml9fQI66M2EXzqFZ", 'lead_format' => ".xml", 'lob' => "home", 'data' => $data, 'firstname' => $_POST["firstname"], 'lastname' => $_POST["lastname"], 'state' => $_POST["state"] ) ); # Compose HTTP POST request $opts = array('http' => array( 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ) ); $context = stream_context_create($opts); # Place POST request $json_string = file_get_contents('https://leads.semcat.net/put_message', false, $context); //var_dump($http_response_header); //var_dump($json_string); # Parse resulting JSON $decoded_json = json_decode($json_string, true); //var_dump($decoded_json); } ?></td></tr> </tbody> </table> <button class="btn btn-primary" value="START OVER"><a style="color:white" href = "compare-rates.php">START OVER</a></button> </div> </div> </div> </div> </div> <?php include("footer-success.php"); ?>