Файловый менеджер - Редактировать - /home/d46091/public_html/dynamic-page.php
Назад
<?php include_once('config.php'); header("Expires: Tue, 01 Jan 2000 00:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); $website = $_SERVER['SERVER_NAME']; $page_name = basename($_SERVER['PHP_SELF']); $url = 'https://seo.techlounge.co.in/api/getWebsiteData.php'; $data = [ 'selected_website' => $website, 'page_name' => $page_name, 'approval' => '1', ]; try { $ch = curl_init($url); curl_setopt_array($ch, [CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $data, CURLOPT_RETURNTRANSFER => true]); $response = curl_exec($ch); if ($response === false) { throw new Exception(curl_error($ch)); } curl_close($ch); $resposneArray = json_decode($response, true); // Check if API response contains an error key if (isset($resposneArray['error'])) { throw new Exception($resposneArray['error']); } // Check if approval is 0 if ($resposneArray['approval'] == 0) { $sql = 'SELECT * FROM bckup_data WHERE page_name ="'.$page_name.'"'; $result = $conn->query($sql); $row = $result->fetch_assoc(); $title = $row['title']; $description = $row['description']; $h1 = $row['h1']; $h2 = $row['h2']; $form_heading = $row['form_heading']; $form_instruction = $row['form_instruction']; } else { // Use the data from the API response $title = $resposneArray['title']; $description = $resposneArray['description']; $h1 = $resposneArray['h1']; $h2 = $resposneArray['h2']; $form_heading = $resposneArray['form_heading']; $form_instruction = $resposneArray['form_instruction']; } } catch (Exception $e) { // Handle the exception (API error) by showing static data $sql = 'SELECT * FROM bckup_data WHERE page_name ="'.$page_name.'"'; $result = $conn->query($sql); $row = $result->fetch_assoc(); $title = $row['title']; $description = $row['description']; $h1 = $row['h1']; $h2 = $row['h2']; $form_heading = $row['form_heading']; $form_instruction = $row['form_instruction']; // You can also log or display the error message if needed error_log("API Error: " . $e->getMessage()); } ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.32 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка