'https://uploadocs.in/json/dev-list.php', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', )); $response = curl_exec($curl); curl_close($curl); $website_form_id = base64_decode($_GET['oid']); list($order_ids, $domains, $business, $type) = explode(',', $website_form_id, 4); $domain = strtoupper($domains); // echo $response; $data = json_decode($response, true); if (isset($data[$domain])) { $servername = $data[$domain]['hostname']; $username = $data[$domain]['username']; $password = $data[$domain]['password']; $dbname = $data[$domain]['database']; $table = $data[$domain]['table'][$business]; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } else { $sql_table = "SELECT * FROM $table WHERE order_id='$order_ids'"; $result_table = $conn->query($sql_table); $row_table = $result_table->fetch_assoc(); $amount = $row_table['total_amount']; $date = $row_table['form_created_on']; $fid = $row_table['id']; $cus_full_name = $row_table['applicant_name']; $cus_email = $row_table['email_id']; $business_name = $row_table['business_name']; $mobile_no = $row_table['mobile_number']; } } $order_id = isset($order_ids) ? trim($order_ids) : ''; $otype = isset($type) ? trim($type) : ''; if (empty($order_id)) { http_response_code(400); echo json_encode(["error" => "Missing required parameter: oid"]); exit(); } if (empty($otype)) { http_response_code(400); echo json_encode(["error" => "Missing required parameter: otype"]); exit(); } $apiUrl = "https://demolounge.in/admin/otp_get_details_api.php?order_id=" . urlencode($order_id) . "&ptype=" . urlencode($otype); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $apiUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_FAILONERROR, true); $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $curlError = curl_error($ch); curl_close($ch); if ($response === false) { http_response_code(500); echo json_encode(["error" => "Error fetching data from API", "curl_error" => $curlError]); exit(); } if ($http_code !== 200) { http_response_code($http_code); echo json_encode(["error" => "API request failed", "http_code" => $http_code, "raw_response" => $response]); exit(); } $client_data = json_decode($response, true); if (json_last_error() !== JSON_ERROR_NONE) { http_response_code(500); echo json_encode(["error" => "Error decoding JSON response", "json_error" => json_last_error_msg(), "raw_response" => $response]); exit(); } $client_otp = $client_data['otp_data'] ?? []; $client_data = $client_data['client_data'] ?? []; $client_id = $client_data['id'] ?? ''; $business_area = $client_data['business_area'] ?? ''; $cus_full_name = $client_data['cus_full_name'] ?? ''; $cus_email = $client_data['cus_email'] ?? ''; $business_name = $client_otp['business_name'] ?? ''; $form_name = $client_otp['form_name'] ?? ''; $mobile_no = $client_otp['mobile_no'] ?? ''; $otp_type = $client_otp['otp_type'] ?? ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $submitted_otp = isset($_POST['client_otp']) ? trim($_POST['client_otp']) : ''; if (empty($submitted_otp) || strlen($submitted_otp) !== 6 || !ctype_digit($submitted_otp)) { echo json_encode(["error" => "Invalid OTP. Please enter a valid 6-digit number."]); exit(); } $verifyApiUrl = "https://demolounge.in/admin/api_otp_submit.php"; $postData = [ 'client_id' => $client_id, 'otp_type' => $otp_type, 'client_otp' => $submitted_otp ]; $ch = curl_init($verifyApiUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData)); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $verifyResponse = curl_exec($ch); curl_close($ch); $crmResp = json_decode($verifyResponse, true); if (is_array($crmResp) && isset($crmResp["message"]) && $crmResp["message"] === "OTP updated successfully.") { $domain = htmlspecialchars($domain, ENT_QUOTES, 'UTF-8'); echo ""; } else { echo "Error: Invalid response format"; } exit(); } ?>
Applicant Name | |
---|---|
Email ID | |
Business Name | |
Mobile No. |