![]() 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/gocodeme.com/public_html/BACKUP/ |
<?php
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
<title>API Debug - 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 Debug - Step by Step</h1>
<?php
$API_KEY = '63edba40620216c5aa2c04240ac41dbd';
$API_URL = 'https://api.box';
echo "<div class='test-section'>";
echo "<h2>1. Basic Connection Test</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_VERBOSE, true);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
echo "<p><strong>URL:</strong> $API_URL</p>";
echo "<p><strong>HTTP Code:</strong> $httpCode</p>";
if ($error) {
echo "<p class='error'><strong>Error:</strong> $error</p>";
} else {
echo "<p class='success'><strong>Response:</strong></p>";
echo "<pre>" . htmlspecialchars($response) . "</pre>";
}
echo "</div>";
echo "<div class='test-section'>";
echo "<h2>2. Test Different API Endpoints</h2>";
$endpoints = [
'/music/generate',
'/music',
'/generate',
'/api/music/generate',
'/v1/music/generate'
];
foreach ($endpoints as $endpoint) {
echo "<h3>Testing: $endpoint</h3>";
$testData = [
'prompt' => 'test melody',
'model' => 'v3',
'duration' => 10
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . $endpoint);
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);
$error = curl_error($ch);
curl_close($ch);
echo "<p><strong>HTTP Code:</strong> $httpCode</p>";
if ($error) {
echo "<p class='error'><strong>Error:</strong> $error</p>";
} else {
echo "<p><strong>Response:</strong></p>";
echo "<pre>" . htmlspecialchars($response) . "</pre>";
}
echo "<hr>";
}
echo "</div>";
echo "<div class='test-section'>";
echo "<h2>3. Test API Key Validity</h2>";
// Try a simple GET request to see if the API key works
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/account');
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);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "<p><strong>Account Check (HTTP $httpCode):</strong></p>";
echo "<pre>" . htmlspecialchars($response) . "</pre>";
echo "</div>";
echo "<div class='test-section'>";
echo "<h2>4. Test Your Backend API</h2>";
$testData = [
'action' => 'music',
'prompt' => 'test melody',
'model' => 'v3',
'duration' => 10
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/api.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($testData));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['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);
$error = curl_error($ch);
curl_close($ch);
echo "<p><strong>Your API Response (HTTP $httpCode):</strong></p>";
if ($error) {
echo "<p class='error'><strong>Error:</strong> $error</p>";
} else {
echo "<pre>" . htmlspecialchars($response) . "</pre>";
}
echo "</div>";
echo "<div class='test-section'>";
echo "<h2>5. Check Server Configuration</h2>";
echo "<p><strong>PHP Version:</strong> " . PHP_VERSION . "</p>";
echo "<p><strong>cURL Available:</strong> " . (function_exists('curl_init') ? 'Yes' : 'No') . "</p>";
echo "<p><strong>JSON Available:</strong> " . (function_exists('json_encode') ? 'Yes' : 'No') . "</p>";
echo "<p><strong>OpenSSL Available:</strong> " . (extension_loaded('openssl') ? 'Yes' : 'No') . "</p>";
echo "<p><strong>Max Execution Time:</strong> " . ini_get('max_execution_time') . " seconds</p>";
echo "<p><strong>Memory Limit:</strong> " . ini_get('memory_limit') . "</p>";
echo "</div>";
?>
<hr>
<h2>๐ Quick Links</h2>
<ul>
<li><a href="musicstudio.html">๐ต MusicStudio Pro</a></li>
<li><a href="test_workflow.php">๐งช Workflow Test</a></li>
<li><a href="diagnostic.php">๐ง Server Diagnostic</a></li>
</ul>
</body>
</html>