File manager - Edit - /home/asiatechinc/public_html/asiatech-websites/grpremium.com/mail.php
Back
<?php // reCAPTCHA secret key $secretKey = "6LeTtrwrAAAAAGrjKIfiujGAh8OFzZ9o6O2CBlpO"; // Collect form data $firstName = $_POST["first_name"] ?? ''; $lastName = $_POST["last_name"] ?? ''; $email = $_POST["email"] ?? ''; $phone = $_POST["phone"] ?? ''; $countryResidence = $_POST["country_residence"] ?? ''; $buyingPlan = $_POST["buying_plan"] ?? ''; $consent = isset($_POST["consent"]) ? "Yes" : "No"; $recaptchaResponse = $_POST['g-recaptcha-response'] ?? ''; // Verify reCAPTCHA $verifyUrl = "https://www.google.com/recaptcha/api/siteverify"; $recaptchaData = [ 'secret' => $secretKey, 'response' => $recaptchaResponse, 'remoteip' => $_SERVER['REMOTE_ADDR'] ]; $options = [ 'http' => [ 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($recaptchaData) ] ]; $context = stream_context_create($options); $response = file_get_contents($verifyUrl, false, $context); $responseKeys = json_decode($response, true); // If reCAPTCHA fails if (!$responseKeys["success"]) { echo "<h1>reCAPTCHA Error</h1><p>Please try again.</p>"; exit; } // ✅ Function to send data to LeadRat Webhook function sendToLeadRatWebhook($name, $mobile, $email, $notes) { $curl = curl_init(); // Replace with your actual webhook URL from CRM Excel $webhookUrl = 'https://connect.leadrat.com/api/v1/integration/Webhook/grpp/ZTdhOTRjM2UtMTMwMS00YmFhLTkzMzktZDI4N2UzNDcyYzE5'; // Replace with your actual API Key from CRM Excel $apiKey = 'ZTdhOTRjM2UtMTMwMS00YmFhLTkzMzktZDI4N2UzNDcyYzE5'; $payload = json_encode([ "name" => $name, "mobile" => $mobile, "email" => $email, "notes" => $notes ]); curl_setopt_array($curl, [ CURLOPT_URL => $webhookUrl, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $payload, CURLOPT_HTTPHEADER => [ "API-Key: $apiKey", "Content-Type: application/json" ], ]); $response = curl_exec($curl); if (curl_errno($curl)) { error_log('LeadRat Webhook Error: ' . curl_error($curl)); } else { error_log('LeadRat Webhook Response: ' . $response); } curl_close($curl); } // Send email $EmailTo = "grpremiumpropertiesllc@gmail.com"; $Subject = "Enquiry From G R Premium Properties LLC"; $message = " <table border='1' style='border-collapse:collapse;width:100%;'> <tr><td><b>First Name</b></td><td>$firstName</td></tr> <tr><td><b>Last Name</b></td><td>$lastName</td></tr> <tr><td><b>Email</b></td><td>$email</td></tr> <tr><td><b>Phone</b></td><td>$phone</td></tr> <tr><td><b>Country of Residence</b></td><td>$countryResidence</td></tr> <tr><td><b>Buying Plan</b></td><td>$buyingPlan</td></tr> <tr><td><b>Consent</b></td><td>$consent</td></tr> </table> "; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type:text/html;charset=UTF-8\r\n"; $headers .= "From: $email\r\n"; mail($EmailTo, $Subject, $message, $headers); // Send data to LeadRat webhook $fullName = trim($firstName . ' ' . $lastName); $notes = "Country: $countryResidence | Buying Plan: $buyingPlan | Consent: $consent"; sendToLeadRatWebhook($fullName, $phone, $email, $notes); // Redirect to thank-you page header("Location: thank-you.php"); exit; ?>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings