Thank you for taking the quiz
One of our Business Loan Specialists will call you within the next 60 minutes with your loan options.
[insert_php]
$loanAmount= $_GET['loanAmount'];
$firstName= $_GET['firstName'];
$lastName= $_GET['lastName'];
$phoneNumber= $_GET['phoneNumber'];
$emailAddress= $_GET['emailAddress'];
$annualTurnoverOption= $_GET['annualTurnoverOption'];
$timeInBusinessOption= $_GET['timeInBusinessOption'];
$businessState= $_GET['businessState'];
$besttimetocall= $_GET['besttimetocall'];
//$loanAmount= '100000';
//$firstName= 'LoanHero21';
//$lastName= 'LoanHero22';
//$phoneNumber= '0402444888';
//$emailAddress= 'namiradaki@test.com';
//$annualTurnoverOption= '200000';
//$timeInBusinessOption= '3 - 6 months';
//$businessState= 'NSW';
//$besttimetocall= '8am-9am';
//Sanitise currency numbers into integers, and remove spaces from phone numbers.
$loanAmount= filter_var($loanAmount, FILTER_SANITIZE_NUMBER_INT);
$annualTurnoverOption= filter_var($annualTurnoverOption, FILTER_SANITIZE_NUMBER_INT);
$phoneNumber = str_replace(' ', '', $phoneNumber);
//Best time to call customer
$besttimetocall = "Customer requested call: $besttimetocall";
//echo "
". $loanAmount . "
"; //echo "". $firstName . "
"; //echo "". $lastName . "
"; //echo "". $phoneNumber . "
"; //echo "". $emailAddress . "
"; //echo "". $annualTurnoverOption . "
"; //echo "". $timeInBusinessOption . "
"; //echo "". $businessState . "
"; //API Url //Sandbox //$url = 'https://api.prospa.com/leadgeneration/sandbox/2016-09-26/leadv2'; //Production $url = 'https://api.prospa.com/leadgeneration/live/2016-09-26/leadv2'; //Initiate cURL. $ch = curl_init($url); //The JSON data. $jsonData = array( 'loanAmount' => $loanAmount, 'firstName' => $firstName, 'lastName' => $lastName, 'phoneNumber' => $phoneNumber, 'emailAddress' => $emailAddress, 'annualTurnoverOption' => $annualTurnoverOption, 'timeInBusinessOption' => $timeInBusinessOption, 'businessState' => $businessState, 'besttimetocall' => $besttimetocall ); //Encode the array into JSON. $jsonDataEncoded = json_encode($jsonData); // Echo out jsondata //echo $jsonDataEncoded; //echo '1'; //Tell cURL that we want to send a POST request. curl_setopt($ch, CURLOPT_POST, 1); //echo '2'; //Attach our encoded JSON string to the POST fields. curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded); //echo '3'; //Set the content type to application/json curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Ocp-Apim-Subscription-Key: fb1ec2933ffc46b188076730b89640ba' )); //echo '4'; //Execute the request $result = curl_exec($ch); $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); //echo "". $httpcode . "
"; //Send email notification if unable to connect to Prospa API. if ($httpcode == '200' or $httpcode == '202'){ //echo "Success - Posted to APII"; } else { //echo "Error - Failed to post to API"; $to = "info@theloanhero.com.au"; $subject = "IMPORTANT: Prospa Post API Failed"; $body = "API Post Failed with http code: $httpcode"; if (wp_mail( $to, $subject, $body )) { //echo("Email successfully sent!
"); } else { //echo("Email delivery failed…
"); } }[/insert_php]