Files
2026-06-10 22:22:44 +07:00

30 lines
737 B
PHP

<?php
// Set header JSON untuk semua response
header('Content-Type: application/json');
$host = 'ywwoc0wwgww088gw40wgso0k';
$user = 'mysql';
$password = '2takzMbig9QgYcrHjxNYz5YBVVYrx95oSVhPisdGhqkmBbD3jKNHZxVG6nEqARkx'; // Pastikan password MySQL Anda
$database = 'default';
try {
// Buat koneksi
$conn = new mysqli($host, $user, $password, $database);
// Cek koneksi
if ($conn->connect_error) {
throw new Exception("Koneksi gagal: " . $conn->connect_error);
}
// Set charset
$conn->set_charset("utf8");
} catch (Exception $e) {
// Jika error, tetap kembalikan JSON
echo json_encode([
'status' => 'error',
'message' => $e->getMessage()
]);
exit;
}
?>