![]() 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/public_html/utils/ |
<?php
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
<title>Correct API Test - MusicStudio Pro</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.success { color: green; }
.error { color: red; }
pre { background: #f5f5f5; padding: 10px; border-radius: 5px; }
</style>
</head>
<body>
<h1>✅ Testing Correct API URL</h1>
<?php
$API_KEY = '63edba40620216c5aa2c04240ac41dbd';
$API_URL = 'https://api.box';
echo "<h2>Testing: $API_URL</h2>";
// Test basic connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
echo "<p><strong>Basic Connection (HTTP $httpCode):</strong></p>";
if ($error) {
echo "<p class='error'>Error: $error</p>";
} else {
echo "<pre>" . htmlspecialchars($response) . "</pre>";
}
// Test music generation
$testData = [
'prompt' => 'A peaceful acoustic guitar melody',
'model' => 'v3',
'duration' => 10
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/music/generate');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($testData));
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);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "<p><strong>Music Generation (HTTP $httpCode):</strong></p>";
echo "<pre>" . htmlspecialchars($response) . "</pre>";
if ($httpCode == 200 || $httpCode == 201) {
echo "<p class='success'>🎉 API is working correctly!</p>";
} elseif ($httpCode == 401) {
echo "<p class='error'>❌ API key authentication failed</p>";
} elseif ($httpCode == 404) {
echo "<p class='error'>❌ Endpoint not found</p>";
} else {
echo "<p class='error'>❌ Unexpected response</p>";
}
?>
<hr>
<p><a href="musicstudio.html">🎵 Test MusicStudio Pro</a></p>
</body>
</html>