![]() 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
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
<title>API.box Test - MusicStudio Pro</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.success { color: green; }
.error { color: red; }
.warning { color: orange; }
pre { background: #f5f5f5; padding: 10px; border-radius: 5px; margin: 10px 0; }
.test-section { border: 1px solid #ddd; padding: 15px; margin: 15px 0; border-radius: 5px; }
</style>
</head>
<body>
<h1>🔍 API.box Test</h1>
<?php
$API_KEY = '63edba40620216c5aa2c04240ac41dbd';
// Test API.box endpoints
$api_base = 'https://api.api.box';
$endpoints = [
'Base URL' => '',
'Status' => '/api/v1/status',
'Generate' => '/api/v1/generate',
'Lyrics' => '/api/v1/lyrics',
'Info' => '/api/v1/info'
];
foreach ($endpoints as $name => $endpoint) {
echo "<div class='test-section'>";
echo "<h2>Testing: $name</h2>";
$url = $api_base . $endpoint;
// Test connection
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $API_KEY,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
echo "<p><strong>URL:</strong> $url</p>";
echo "<p><strong>HTTP Code:</strong> $httpCode</p>";
if ($error) {
echo "<p class='error'>Error: $error</p>";
} else {
echo "<pre>" . htmlspecialchars($response) . "</pre>";
}
if ($httpCode == 200 || $httpCode == 201) {
echo "<p class='success'>✅ Endpoint working!</p>";
} elseif ($httpCode == 401) {
echo "<p class='error'>❌ Authentication failed</p>";
} elseif ($httpCode == 404) {
echo "<p class='warning'>⚠️ Endpoint not found</p>";
} else {
echo "<p class='error'>❌ Unexpected response</p>";
}
echo "</div>";
}
echo "<div class='test-section'>";
echo "<h2>🔍 Test Music Generation</h2>";
$testData = [
'prompt' => 'A peaceful acoustic guitar melody',
'model' => 'v3',
'duration' => 10
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_base . '/api/v1/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, 30);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "<p><strong>Music Generation Test (HTTP $httpCode):</strong></p>";
echo "<pre>" . htmlspecialchars($response) . "</pre>";
if ($httpCode == 200 || $httpCode == 201) {
echo "<p class='success'>🎉 Music generation working!</p>";
} else {
echo "<p class='error'>❌ Music generation failed</p>";
}
echo "</div>";
echo "<div class='test-section'>";
echo "<h2>🔍 Test Lyrics Generation</h2>";
$lyricsData = [
'prompt' => 'Generate lyrics for a song about hope and dreams',
'model' => 'v3',
'duration' => 30
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_base . '/api/v1/lyrics');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($lyricsData));
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);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "<p><strong>Lyrics Generation Test (HTTP $httpCode):</strong></p>";
echo "<pre>" . htmlspecialchars($response) . "</pre>";
if ($httpCode == 200 || $httpCode == 201) {
echo "<p class='success'>🎉 Lyrics generation working!</p>";
} else {
echo "<p class='error'>❌ Lyrics generation failed</p>";
}
echo "</div>";
?>
</body>
</html>