T.ME/BIBIL_0DAY
CasperSecurity


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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/soundstudiopro.com/private_html/utils/retrieve_track_result.php
<?php
// Manually retrieve successful track result from API.Box
error_reporting(E_ALL);
ini_set('display_errors', 1);

$task_id = '6490c73e789c4943b8ebb5c9b1e71434';
$api_key = '63edba40620216c5aa2c04240ac41dbd';

echo "<h1>🎵 Retrieve Track Result</h1>";
echo "<h2>Task ID: $task_id</h2>";

// First, let's check the current local status
require_once 'config/database.php';
$pdo = getDBConnection();

if ($pdo) {
    $stmt = $pdo->prepare("SELECT * FROM music_tracks WHERE task_id = ?");
    $stmt->execute([$task_id]);
    $track = $stmt->fetch();
    
    if ($track) {
        echo "<h3>📊 Current Local Status</h3>";
        echo "<p><strong>Status:</strong> {$track['status']}</p>";
        echo "<p><strong>Audio URL:</strong> " . ($track['audio_url'] ?: 'NULL') . "</p>";
    }
}

// Try to get the result from API.Box
echo "<h3>🌐 Retrieving from API.Box</h3>";

// Try different possible endpoints for getting results
$endpoints = [
    "https://api.api.box/api/v1/result/$task_id",
    "https://api.api.box/api/v1/task/$task_id/result",
    "https://api.api.box/api/v1/generate/result/$task_id",
    "https://api.api.box/api/v1/music/result/$task_id"
];

$result_found = false;

foreach ($endpoints as $endpoint) {
    echo "<p><strong>Trying:</strong> $endpoint</p>";
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $endpoint);
    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>HTTP Code:</strong> $http_code</p>";
    
    if ($http_code === 200 && $response) {
        echo "<p style='color: green;'>✅ Success! Found result at this endpoint</p>";
        
        $data = json_decode($response, true);
        if ($data) {
            echo "<h4>📋 Result Data</h4>";
            echo "<pre style='background: #f0f0f0; padding: 10px; max-height: 300px; 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'];
            }
            
            if ($audio_url) {
                echo "<h4>🎵 Audio URL Found</h4>";
                echo "<p><strong>URL:</strong> $audio_url</p>";
                
                // Test if the audio URL is accessible
                $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>";
                    
                    // Update local database
                    if ($pdo && $track) {
                        $stmt = $pdo->prepare("
                            UPDATE music_tracks 
                            SET status = 'complete', 
                                audio_url = ?, 
                                updated_at = NOW() 
                            WHERE task_id = ?
                        ");
                        
                        if ($stmt->execute([$audio_url, $task_id])) {
                            echo "<p style='color: green;'>✅ Local database updated successfully!</p>";
                            echo "<p><strong>Your track is now ready!</strong></p>";
                            
                            // Show audio player
                            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>";
                            
                            $result_found = true;
                            break;
                        } else {
                            echo "<p style='color: red;'>❌ Failed to update local database</p>";
                        }
                    }
                } else {
                    echo "<p style='color: orange;'>⚠️ Audio file may not be accessible (HTTP $audio_http_code)</p>";
                }
            } else {
                echo "<p style='color: orange;'>⚠️ No audio URL found in response</p>";
            }
        } else {
            echo "<p style='color: red;'>❌ Failed to parse JSON response</p>";
        }
    } else {
        echo "<p style='color: grey;'>❌ Endpoint not found or error</p>";
    }
    
    echo "<hr>";
}

if (!$result_found) {
    echo "<h3>🔄 Manual Callback Trigger</h3>";
    echo "<p>Since we couldn't retrieve the result directly, let's try to trigger the callback manually:</p>";
    
    // Try to simulate the callback with a test audio URL
    $test_audio_url = "https://api.api.box/audio/" . $task_id . ".mp3";
    
    echo "<p><strong>Test Audio URL:</strong> $test_audio_url</p>";
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, '/callback.php');
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
        'taskId' => $task_id,
        'status' => 'complete',
        'audioUrl' => $test_audio_url,
        'title' => 'Happy Music For Priscilla',
        'duration' => 30
    ]));
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Content-Type: application/json'
    ]);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    $callback_response = curl_exec($ch);
    $callback_http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    
    echo "<p><strong>Callback Response:</strong> HTTP $callback_http_code</p>";
    echo "<p><strong>Response:</strong> $callback_response</p>";
}

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>";
?> 

CasperSecurity Mini