![]() 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 API connection to api.box
$API_KEY = '63edba40620216c5aa2c04240ac41dbd';
$API_URL = 'https://api.api.box';
echo "<h1>🔍 API Connection Test</h1>";
// Test 1: Check if we can reach the API
echo "<h2>Test 1: Basic Connection</h2>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
echo "HTTP Code: $httpCode<br>";
echo "Error: " . ($error ?: 'None') . "<br>";
echo "Response: <pre>" . htmlspecialchars($response) . "</pre><br>";
// Test 2: Try the generate endpoint
echo "<h2>Test 2: Generate Endpoint</h2>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/api/v1/music/generate');
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);
$error = curl_error($ch);
curl_close($ch);
echo "HTTP Code: $httpCode<br>";
echo "Error: " . ($error ?: 'None') . "<br>";
echo "Response: <pre>" . htmlspecialchars($response) . "</pre><br>";
// Test 3: Try without authentication
echo "<h2>Test 3: Without Authentication</h2>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/api/v1/music/generate');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'prompt' => 'A beautiful piano melody'
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'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);
$error = curl_error($ch);
curl_close($ch);
echo "HTTP Code: $httpCode<br>";
echo "Error: " . ($error ?: 'None') . "<br>";
echo "Response: <pre>" . htmlspecialchars($response) . "</pre><br>";
// Test 4: Check if it's a different endpoint
echo "<h2>Test 4: Alternative Endpoints</h2>";
$endpoints = [
'/api/v1/music/generate',
'/api/v1/lyrics/generate',
'/api/v1/audio/convert',
'/api/v1/audio/vocal-removal',
'/api/v1/video/generate',
'/api/v1/music/extend'
];
foreach ($endpoints as $endpoint) {
echo "<h3>Testing: $endpoint</h3>";
$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);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "HTTP Code: $httpCode<br>";
echo "Response: <pre>" . htmlspecialchars(substr($response, 0, 200)) . "</pre><br>";
}
echo "<h2>Conclusion</h2>";
echo "<p>The API key or endpoint appears to be invalid. You need to:</p>";
echo "<ul>";
echo "<li>Get a valid API key from api.box</li>";
echo "<li>Check the correct API endpoints</li>";
echo "<li>Verify the API documentation</li>";
echo "</ul>";
?>