![]() 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
// Test script to check API directly
error_reporting(E_ALL);
ini_set('display_errors', 1);
echo "<h1>🔧 API Test Script</h1>";
// Your API key
$API_KEY = '63edba40620216c5aa2c04240ac41dbd';
$API_URL = 'https://api.api.box';
echo "<h2>1. Testing API Connection</h2>";
// Test 1: Check if API is reachable
$testUrl = $API_URL . '/api/v1/status';
echo "<p>Testing API endpoint: $testUrl</p>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $testUrl);
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); // Disable SSL verification for testing
$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>cURL Error:</strong> $error</p>";
} else {
echo "<p style='color: green;'><strong>cURL:</strong> Success</p>";
}
echo "<p><strong>Response:</strong></p>";
echo "<pre style='background: #f0f0f0; padding: 10px; max-height: 200px; overflow-y: auto;'>";
echo htmlspecialchars($response);
echo "</pre>";
echo "<h2>2. Testing Music Generation</h2>";
// Test 2: Try to create a music generation task
$createData = [
'prompt' => 'A happy song about danny',
'model' => 'V3_5',
'style' => 'Pop',
'title' => 'Danny Test Song',
'customMode' => true,
'instrumental' => false,
'duration' => 30,
'callBackUrl' => 'https://soundstudiopro.com/callback.php'
];
echo "<p><strong>Request Data:</strong></p>";
echo "<pre style='background: #f0f0f0; padding: 10px;'>";
echo htmlspecialchars(json_encode($createData, 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($createData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $API_KEY,
'Content-Type: application/json',
'User-Agent: MusicStudio-Pro/1.0'
]);
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>cURL Error:</strong> $error</p>";
} else {
echo "<p style='color: green;'><strong>cURL:</strong> Success</p>";
}
echo "<p><strong>Response:</strong></p>";
echo "<pre style='background: #f0f0f0; padding: 10px; max-height: 200px; overflow-y: auto;'>";
echo htmlspecialchars($response);
echo "</pre>";
// Parse the response
$decoded = json_decode($response, true);
if ($decoded && isset($decoded['data']['taskId'])) {
$taskId = $decoded['data']['taskId'];
echo "<p style='color: green;'><strong>✅ Task Created:</strong> $taskId</p>";
// Test 3: Check task status
echo "<h2>3. Checking Task Status</h2>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/api/v1/task/' . $taskId . '/details');
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);
$statusResponse = curl_exec($ch);
$statusHttpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "<p><strong>Status HTTP Code:</strong> $statusHttpCode</p>";
echo "<p><strong>Status Response:</strong></p>";
echo "<pre style='background: #f0f0f0; padding: 10px; max-height: 200px; overflow-y: auto;'>";
echo htmlspecialchars($statusResponse);
echo "</pre>";
} else {
echo "<p style='color: red;'><strong>❌ Failed to create task</strong></p>";
if ($decoded && isset($decoded['error'])) {
echo "<p style='color: red;'><strong>Error:</strong> " . htmlspecialchars($decoded['error']) . "</p>";
}
}
echo "<h2>4. API Documentation Check</h2>";
echo "<p>Let me check if there are any documentation endpoints...</p>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/docs');
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$docsResponse = curl_exec($ch);
$docsHttpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "<p><strong>Docs HTTP Code:</strong> $docsHttpCode</p>";
if ($docsHttpCode === 200) {
echo "<p style='color: green;'>✅ Documentation endpoint available</p>";
} else {
echo "<p style='color: orange;'>⚠️ No documentation endpoint found</p>";
}
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>";
?>