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/debug_api_flow.php
<?php
// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);

echo "<h2>Debug API Flow</h2>";

// Test the exact same flow as the frontend
$api_url = 'https://api.api.box/api/v1/generate';
$api_key = '63edba40620216c5aa2c04240ac41dbd';

// Simulate the exact request from frontend
$api_data = [
    'prompt' => 'A happy upbeat melody',
    'model' => 'V3_5',
    'style' => 'Pop',
    'title' => 'Test Track',
    'customMode' => false,
    'instrumental' => false,
    'duration' => 30,
    'callBackUrl' => 'https://soundstudiopro.com/callback.php'
];

echo "<p><strong>Request Data:</strong></p>";
echo "<pre>" . json_encode($api_data, JSON_PRETTY_PRINT) . "</pre>";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($api_data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $api_key,
    'Content-Type: application/json',
    'User-Agent: SoundStudioPro-Music/2.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 ($curl_error) {
    echo "<p style='color: red;'>❌ cURL Error: $curl_error</p>";
} else {
    echo "<p style='color: green;'>✅ cURL request successful</p>";
}

echo "<p><strong>Response:</strong></p>";
echo "<pre>" . htmlspecialchars($response) . "</pre>";

$api_result = json_decode($response, true);

if ($http_code === 200 && isset($api_result['code']) && $api_result['code'] === 200) {
    echo "<p style='color: green;'>✅ API.Box request successful!</p>";
    echo "<p>Task ID: " . ($api_result['data']['taskId'] ?? 'N/A') . "</p>";
    
    // Now test the database part
    try {
        require_once 'config/database.php';
        $pdo = getDBConnection();
        
        // Create track record
        $task_id = $api_result['data']['taskId'];
        $title = 'Test Track - ' . substr($api_data['prompt'], 0, 30);
        $metadata = json_encode([
            'customMode' => $api_data['customMode'],
            'instrumental' => $api_data['instrumental'],
            'model_name' => $api_data['model'],
            'duration' => $api_data['duration']
        ]);
        
        $stmt = $pdo->prepare("
            INSERT INTO music_tracks (user_id, task_id, title, prompt, music_type, status, metadata, created_at) 
            VALUES (?, ?, ?, ?, 'music', 'processing', ?, NOW())
        ");
        $stmt->execute([1, $task_id, $title, $api_data['prompt'], $metadata]);
        $track_id = $pdo->lastInsertId();
        
        echo "<p style='color: green;'>✅ Track created in database!</p>";
        echo "<p>Track ID: $track_id</p>";
        echo "<p>Task ID: $task_id</p>";
        
        // Now check if it appears in API.Box
        echo "<h3>Checking API.Box for the task...</h3>";
        
        // Try to check task status
        $status_url = "https://api.api.box/api/v1/status/$task_id";
        
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $status_url);
        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);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        
        $status_response = curl_exec($ch);
        $status_http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        
        echo "<p><strong>Status Check HTTP Code:</strong> $status_http_code</p>";
        echo "<p><strong>Status Response:</strong></p>";
        echo "<pre>" . htmlspecialchars($status_response) . "</pre>";
        
    } catch (Exception $e) {
        echo "<p style='color: red;'>❌ Database error: " . $e->getMessage() . "</p>";
    }
    
} else {
    echo "<p style='color: red;'>❌ API.Box request failed</p>";
    if ($api_result) {
        echo "<p>Error: " . ($api_result['msg'] ?? 'Unknown error') . "</p>";
    }
}

echo "<h3>Test Complete</h3>";
?> 

CasperSecurity Mini