Denetlemek İstediğiniz Sunucuya Yükleyip Sitelerinizi Denetleyebilirsiniz.
PHP:
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<title>Sunucu Denetimi</title>
</head>
<body>
<h1>Sunucu Denetimi</h1>
<form action="index.php" method="post">
<label for="site">Site Adı:</label>
<input type="text" id="site" name="site" required>
<input type="submit" value="Denetle">
</form>
<hr>
<h2>Sonuçlar</h2>
<p id="sonuc"></p>
<script>
const form = document.querySelector('form');
const sonuc = document.querySelector('#sonuc');
form.addEventListener('submit', async (e) => {
e.preventDefault();
const site = document.querySelector('#site').value;
const response = await fetch('index.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: `site=${site}`,
});
const data = await response.json();
sonuc.textContent = data.mesaj;
});
</script>
<?php
if (isset($_POST['site'])) {
$site = $_POST['site'];
// Siteye erişilebilirliği kontrol edin
$ch = curl_init($site);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($responseCode == 200) {
$mesaj = "Siteye erişilebilir.";
} else {
$mesaj = "Siteye erişilemiyor.";
}
echo json_encode(['mesaj' => $mesaj]);
}
?>

