![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/private_html/utils/ |
<?php
// Simple API status check
error_reporting(E_ALL);
ini_set('display_errors', 1);
echo "<h1>🔧 API Status Check</h1>";
// Current API key
$API_KEY = '63edba40620216c5aa2c04240ac41dbd';
$API_URL = 'https://api.api.box';
echo "<h2>Current API Key:</h2>";
echo "<p><code>$API_KEY</code></p>";
echo "<h2>Testing API Endpoints:</h2>";
// Test 1: Check if API is reachable
echo "<h3>1. API Status Check</h3>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/api/v1/status');
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $API_KEY,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
echo "<p><strong>Status Endpoint:</strong> $API_URL/api/v1/status</p>";
echo "<p><strong>HTTP Code:</strong> $httpCode</p>";
if ($error) {
echo "<p style='color: red;'><strong>Error:</strong> $error</p>";
} else {
echo "<p style='color: green;'><strong>Response:</strong></p>";
echo "<pre style='background: #f0f0f0; padding: 10px; max-height: 150px; overflow-y: auto;'>";
echo htmlspecialchars($response);
echo "</pre>";
}
// Test 2: Try a simple music generation with minimal parameters
echo "<h3>2. Simple Music Generation Test</h3>";
$simpleData = [
'prompt' => 'A simple melody',
'model' => 'V3_5',
'duration' => 10
];
echo "<p><strong>Test Data:</strong></p>";
echo "<pre style='background: #f0f0f0; padding: 10px;'>";
echo htmlspecialchars(json_encode($simpleData, JSON_PRETTY_PRINT));
echo "</pre>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/api/v1/generate');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($simpleData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $API_KEY,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
echo "<p><strong>HTTP Code:</strong> $httpCode</p>";
if ($error) {
echo "<p style='color: red;'><strong>Error:</strong> $error</p>";
} else {
echo "<p style='color: green;'><strong>Response:</strong></p>";
echo "<pre style='background: #f0f0f0; padding: 10px; max-height: 200px; overflow-y: auto;'>";
echo htmlspecialchars($response);
echo "</pre>";
$decoded = json_decode($response, true);
if ($decoded) {
if (isset($decoded['data']['taskId'])) {
echo "<p style='color: green;'>✅ <strong>Success!</strong> Task created: " . $decoded['data']['taskId'] . "</p>";
} elseif (isset($decoded['error'])) {
echo "<p style='color: red;'>❌ <strong>API Error:</strong> " . htmlspecialchars($decoded['error']) . "</p>";
} elseif (isset($decoded['code']) && $decoded['code'] == 531) {
echo "<p style='color: red;'>❌ <strong>Generation Failed:</strong> " . htmlspecialchars($decoded['msg']) . "</p>";
}
}
}
// Test 3: Check if we need a different API key format
echo "<h3>3. Alternative API Key Test</h3>";
echo "<p>Let me try without the 'Bearer' prefix...</p>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/api/v1/status');
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: ' . $API_KEY,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "<p><strong>Without 'Bearer' - HTTP Code:</strong> $httpCode</p>";
echo "<p><strong>Response:</strong></p>";
echo "<pre style='background: #f0f0f0; padding: 10px; max-height: 150px; overflow-y: auto;'>";
echo htmlspecialchars($response);
echo "</pre>";
echo "<h2>🔧 Recommendations:</h2>";
echo "<ul>";
echo "<li><strong>API Key Issue:</strong> The error 531 suggests the API key might be expired or invalid</li>";
echo "<li><strong>Service Status:</strong> The API service might be having issues</li>";
echo "<li><strong>Request Format:</strong> The request format might need adjustment</li>";
echo "<li><strong>Rate Limiting:</strong> You might have hit rate limits</li>";
echo "</ul>";
echo "<h2>🔧 Quick Actions:</h2>";
echo "<p><a href='/create.php' style='background: #48bb78; color: white; padding: 0.5rem 1rem; text-decoration: none; border-radius: 5px; margin-right: 1rem;'>🎵 Try Creating Music</a>";
echo "<a href='/find_danny.php' style='background: #667eea; color: white; padding: 0.5rem 1rem; text-decoration: none; border-radius: 5px; margin-right: 1rem;'>🔍 Check Danny Song</a>";
echo "<a href='/dashboard.php' style='background: #764ba2; color: white; padding: 0.5rem 1rem; text-decoration: none; border-radius: 5px;'>🏠 Back to Dashboard</a></p>";
echo "<h2>💡 Next Steps:</h2>";
echo "<ol>";
echo "<li>Check if you need to renew your API key</li>";
echo "<li>Verify the API service status</li>";
echo "<li>Try with a different API key if available</li>";
echo "<li>Check the API documentation for any changes</li>";
echo "</ol>";
?>