![]() 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
// Debug the exact API response from api.box
$API_KEY = '63edba40620216c5aa2c04240ac41dbd';
$API_URL = 'https://api.api.box';
echo "<h1>🔍 API Response Debug</h1>";
// Test the exact same request as our API
$createData = [
'prompt' => 'A beautiful piano melody',
'model' => 'V3_5',
'style' => 'Pop',
'title' => 'Generated Track',
'customMode' => true,
'instrumental' => false,
'duration' => 30,
'callBackUrl' => 'https://soundstudiopro.com/callback.php'
];
echo "<h2>Request Data:</h2>";
echo "<pre>" . json_encode($createData, JSON_PRETTY_PRINT) . "</pre>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/api/v1/generate');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($createData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $API_KEY,
'Content-Type: application/json',
'User-Agent: MusicStudio-Pro/1.0'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_HEADER, true);
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 "<h2>Response Details:</h2>";
echo "HTTP Code: <strong>$httpCode</strong><br>";
echo "cURL Error: " . ($error ?: 'None') . "<br>";
echo "<h3>Full Response:</h3>";
echo "<pre>" . htmlspecialchars($response) . "</pre>";
// Try to parse the response
$headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$body = substr($response, $headerSize);
$decoded = json_decode($body, true);
echo "<h3>Parsed JSON Response:</h3>";
if (json_last_error() === JSON_ERROR_NONE) {
echo "<pre>" . json_encode($decoded, JSON_PRETTY_PRINT) . "</pre>";
} else {
echo "JSON Parse Error: " . json_last_error_msg() . "<br>";
echo "Raw Body: <pre>" . htmlspecialchars($body) . "</pre>";
}
// Test with minimal data
echo "<h2>Test with Minimal Data:</h2>";
$minimalData = [
'prompt' => 'A beautiful piano melody',
'model' => 'V3_5'
];
echo "<h3>Minimal Request:</h3>";
echo "<pre>" . json_encode($minimalData, JSON_PRETTY_PRINT) . "</pre>";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $API_URL . '/api/v1/generate');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($minimalData));
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 "HTTP Code: <strong>$httpCode</strong><br>";
echo "<h3>Minimal Response:</h3>";
echo "<pre>" . htmlspecialchars($response) . "</pre>";
?>