![]() 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
// Get the real audio URL from API.Box result
error_reporting(E_ALL);
ini_set('display_errors', 1);
$task_id = '6490c73e789c4943b8ebb5c9b1e71434';
$api_key = '63edba40620216c5aa2c04240ac41dbd';
echo "<h1>🎵 Get Real Audio URL from API.Box</h1>";
echo "<h2>Task ID: $task_id</h2>";
// Try to get the result by simulating what happens when you click "Result" in API.Box
echo "<h3>🔍 Attempting to get result from API.Box</h3>";
// Method 1: Try the result endpoint
$result_url = "https://api.api.box/api/v1/result/$task_id";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $result_url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
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_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$curl_error = curl_error($ch);
curl_close($ch);
echo "<p><strong>Result URL:</strong> $result_url</p>";
echo "<p><strong>HTTP Code:</strong> $http_code</p>";
if ($http_code === 200 && $response) {
echo "<p style='color: green;'>✅ Success! Got result from API.Box</p>";
$data = json_decode($response, true);
if ($data) {
echo "<h4>📋 Full Response</h4>";
echo "<pre style='background: #f0f0f0; padding: 10px; max-height: 400px; overflow-y: auto;'>";
echo htmlspecialchars(json_encode($data, JSON_PRETTY_PRINT));
echo "</pre>";
// Extract audio URL
$audio_url = null;
if (isset($data['audioUrl'])) {
$audio_url = $data['audioUrl'];
} elseif (isset($data['data']['audioUrl'])) {
$audio_url = $data['data']['audioUrl'];
} elseif (isset($data['result']['audioUrl'])) {
$audio_url = $data['result']['audioUrl'];
} elseif (isset($data['url'])) {
$audio_url = $data['url'];
}
if ($audio_url) {
echo "<h4>🎵 Real Audio URL Found!</h4>";
echo "<p><strong>URL:</strong> $audio_url</p>";
// Update database with real URL
require_once 'config/database.php';
$pdo = getDBConnection();
if ($pdo) {
$stmt = $pdo->prepare("
UPDATE music_tracks
SET audio_url = ?,
updated_at = NOW()
WHERE task_id = ?
");
if ($stmt->execute([$audio_url, $task_id])) {
echo "<p style='color: green;'>✅ Database updated with real audio URL!</p>";
// Test the audio URL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $audio_url);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$result = curl_exec($ch);
$audio_http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "<p><strong>Audio URL Status:</strong> HTTP $audio_http_code</p>";
if ($audio_http_code === 200) {
echo "<p style='color: green;'>✅ Audio file is accessible!</p>";
echo "<h4>🎵 Your Music</h4>";
echo "<audio controls style='width: 100%; max-width: 500px;'>";
echo "<source src='$audio_url' type='audio/mpeg'>";
echo "Your browser does not support the audio element.";
echo "</audio>";
echo "<p><a href='$audio_url' download='Happy_Music_For_Priscilla.mp3' style='color: #667eea; text-decoration: none; padding: 10px 20px; background: #48bb78; color: white; border-radius: 5px; display: inline-block; margin-top: 10px;'>⬇️ Download MP3</a></p>";
echo "<h3>🎉 Success! Your track is now fully ready!</h3>";
echo "<p><a href='/library.php' style='color: #667eea; font-size: 18px; padding: 10px 20px; background: #48bb78; color: white; text-decoration: none; border-radius: 5px;'>📚 View in Library</a></p>";
} else {
echo "<p style='color: orange;'>⚠️ Audio URL returned HTTP $audio_http_code</p>";
echo "<p>You can still try to access it directly: <a href='$audio_url' target='_blank'>$audio_url</a></p>";
}
} else {
echo "<p style='color: red;'>❌ Failed to update database</p>";
}
}
} else {
echo "<p style='color: orange;'>⚠️ No audio URL found in response</p>";
echo "<p>Response structure:</p>";
echo "<pre style='background: #f0f0f0; padding: 10px;'>";
print_r($data);
echo "</pre>";
}
} else {
echo "<p style='color: red;'>❌ Failed to parse JSON response</p>";
echo "<p>Raw response:</p>";
echo "<pre style='background: #f0f0f0; padding: 10px;'>";
echo htmlspecialchars($response);
echo "</pre>";
}
} else {
echo "<p style='color: red;'>❌ Failed to get result (HTTP $http_code)</p>";
if ($curl_error) {
echo "<p><strong>cURL Error:</strong> $curl_error</p>";
}
echo "<p>Raw response:</p>";
echo "<pre style='background: #f0f0f0; padding: 10px;'>";
echo htmlspecialchars($response);
echo "</pre>";
}
echo "<h3>🔗 Quick Actions</h3>";
echo "<p><a href='/library.php' style='color: #667eea;'>📚 View Library</a> | ";
echo "<a href='/create_music.php' style='color: #667eea;'>🎵 Create New Music</a> | ";
echo "<a href='/dashboard.php' style='color: #667eea;'>📊 Dashboard</a></p>";
?>