![]() 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 various endpoint combinations for api.box
$API_KEY = '63edba40620216c5aa2c04240ac41dbd';
$API_URL = 'https://api.api.box';
echo "<h1>🎵 API Endpoint Discovery</h1>";
echo "<p>Testing various endpoint combinations based on api.box documentation...</p>";
// Test different endpoint variations
$endpointTests = [
// Music generation endpoints
'/api/v1/music/generate',
'/api/v1/generate',
'/api/music/generate',
'/api/generate',
'/v1/music/generate',
'/v1/generate',
'/music/generate',
'/generate',
// Alternative paths
'/api/v1/create',
'/api/v1/music/create',
'/api/create',
'/create',
// RESTful variations
'/api/v1/music',
'/api/v1/tracks',
'/api/v1/songs',
// Check if base API is working
'/api/v1',
'/api',
'/'
];
foreach ($endpointTests as $endpoint) {
echo "<h3>Testing: <code>$endpoint</code></h3>";
// Test GET first
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . $endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $API_KEY,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "GET $endpoint - HTTP Code: <strong>$httpCode</strong><br>";
// If GET works, try POST
if ($httpCode !== 404) {
echo "✅ GET endpoint exists! Testing POST...<br>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . $endpoint);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'prompt' => 'A beautiful piano melody',
'style' => 'Pop',
'title' => 'Test Track',
'customMode' => true,
'instrumental' => false,
'duration' => 30,
'callBackUrl' => 'https://soundstudiopro.com/callback.php'
]));
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_HEADER, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "POST $endpoint - HTTP Code: <strong>$httpCode</strong><br>";
echo "Response: <pre>" . htmlspecialchars(substr($response, 0, 300)) . "</pre><br>";
}
echo "<hr>";
}
// Test authentication
echo "<h2>🔐 Authentication Test</h2>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/api/v1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $API_KEY,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "Authentication test - HTTP Code: <strong>$httpCode</strong><br>";
echo "Response: <pre>" . htmlspecialchars($response) . "</pre><br>";
echo "<h2>📋 Summary</h2>";
echo "<p>Based on the api.box documentation, we need to:</p>";
echo "<ul>";
echo "<li>✅ Use the correct API server: <code>https://api.api.box</code></li>";
echo "<li>❌ Find the correct endpoint paths</li>";
echo "<li>❌ Verify the API key is valid</li>";
echo "<li>❌ Check the request format</li>";
echo "</ul>";
?>