Disk Limit: " . formatSize($disk_limit) . "
"; echo "Percentage Used: $percent_used%
"; } else { echo "Error fetching cPanel disk usage data. Please check your credentials.
"; } } else { echo "Please provide both the cPanel Username and API Token.
"; } } // Function to format bytes into human-readable format (KB, MB, GB) function formatSize($size) { $units = ['B', 'KB', 'MB', 'GB', 'TB']; $unit_index = 0; while ($size >= 1024 && $unit_index < 4) { $size /= 1024; $unit_index++; } return round($size, 2) . ' ' . $units[$unit_index]; } ?>