?php header('Content-Type: application/json'); $pdo = new PDO('mysql:host=localhost;dbname=YOUR_DB', 'USER', 'PASS'); $body = json_decode(file_get_contents('php://input'), true); $stmt = $pdo->prepare('INSERT INTO crash_logs (store_name,username,app_version,os_version,error_message,stack_trace,excel_filename,excel_row_count,timestamp) VALUES (?,?,?,?,?,?,?,?,?)'); $stmt->execute([ $body['store_name'] ?? '', $body['username'] ?? '', $body['app_version'] ?? '', $body['os_version'] ?? '', $body['error_message'] ?? '', $body['stack_trace'] ?? '', $body['excel_filename'] ?? '', $body['excel_row_count'] ?? 0, $body['timestamp'] ?? date('c'), ]); mail('ADJUST_ME@email.com', 'Passport Generator Crash', json_encode($body, JSON_PRETTY_PRINT)); echo json_encode(['success' => true]);