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/test_pro_studio_apis.php
<?php
/**
 * Test Script for Pro Studio API Endpoints
 * Tests all new API functions: Add Vocals, Add Instrumental, Replace Section, Boost Style, Persona
 */

require_once __DIR__ . '/../config/database.php';
require_once __DIR__ . '/../api_functions.php';

// Your API key from api.box
$api_key = '63edba40620216c5aa2c04240ac41dbd';
$api = new APIBoxFunctions($api_key);

echo "<h1>๐Ÿงช Pro Studio API Test Suite</h1>";
echo "<style>
    body { font-family: Arial, sans-serif; margin: 20px; background: #1a1a1a; color: #e2e8f0; }
    .test-section { background: #2a2a2a; padding: 20px; margin: 20px 0; border-radius: 10px; border: 1px solid #444; }
    .success { color: #4ade80; }
    .error { color: #f87171; }
    .info { color: #60a5fa; }
    pre { background: #1a1a1a; padding: 15px; border-radius: 5px; overflow-x: auto; }
    .endpoint { color: #a78bfa; font-weight: bold; }
</style>";

// Test 1: Add Vocals
echo "<div class='test-section'>";
echo "<h2>๐ŸŽค Test 1: Add Vocals API</h2>";
echo "<p class='endpoint'>Endpoint: POST /api/v1/add-vocals</p>";

$addVocalsParams = [
    'audioUrl' => 'https://example.com/instrumental.mp3', // Replace with actual URL
    'callBackUrl' => 'https://soundstudiopro.com/callback.php',
    'lyrics' => 'Test lyrics for vocals',
    'vocalStyle' => 'clean',
    'language' => 'English'
];

echo "<h3>Request Parameters:</h3>";
echo "<pre>" . json_encode($addVocalsParams, JSON_PRETTY_PRINT) . "</pre>";

try {
    $result = $api->addVocals($addVocalsParams);
    echo "<h3>Response:</h3>";
    echo "<pre class='" . (isset($result['error']) ? 'error' : 'success') . "'>" . json_encode($result, JSON_PRETTY_PRINT) . "</pre>";
    
    if (isset($result['error'])) {
        echo "<p class='error'>โŒ Add Vocals API Error: " . $result['error'] . "</p>";
    } else {
        echo "<p class='success'>โœ… Add Vocals API call successful!</p>";
        if (isset($result['taskId']) || isset($result['data']['taskId'])) {
            $taskId = $result['taskId'] ?? $result['data']['taskId'];
            echo "<p class='info'>Task ID: $taskId</p>";
        }
    }
} catch (Exception $e) {
    echo "<p class='error'>โŒ Exception: " . $e->getMessage() . "</p>";
}
echo "</div>";

// Test 2: Add Instrumental
echo "<div class='test-section'>";
echo "<h2>๐ŸŽธ Test 2: Add Instrumental API</h2>";
echo "<p class='endpoint'>Endpoint: POST /api/v1/add-instrumental</p>";

$addInstrumentalParams = [
    'audioUrl' => 'https://example.com/vocals.mp3', // Replace with actual URL
    'callBackUrl' => 'https://soundstudiopro.com/callback.php',
    'style' => 'Pop, Energetic',
    'genre' => 'Pop',
    'tempo' => 120
];

echo "<h3>Request Parameters:</h3>";
echo "<pre>" . json_encode($addInstrumentalParams, JSON_PRETTY_PRINT) . "</pre>";

try {
    $result = $api->addInstrumental($addInstrumentalParams);
    echo "<h3>Response:</h3>";
    echo "<pre class='" . (isset($result['error']) ? 'error' : 'success') . "'>" . json_encode($result, JSON_PRETTY_PRINT) . "</pre>";
    
    if (isset($result['error'])) {
        echo "<p class='error'>โŒ Add Instrumental API Error: " . $result['error'] . "</p>";
    } else {
        echo "<p class='success'>โœ… Add Instrumental API call successful!</p>";
    }
} catch (Exception $e) {
    echo "<p class='error'>โŒ Exception: " . $e->getMessage() . "</p>";
}
echo "</div>";

// Test 3: Replace Section
echo "<div class='test-section'>";
echo "<h2>๐Ÿ”„ Test 3: Replace Section API</h2>";
echo "<p class='endpoint'>Endpoint: POST /api/v1/replace-section</p>";

$replaceSectionParams = [
    'audioUrl' => 'https://example.com/track.mp3', // Replace with actual URL
    'sectionType' => 'chorus',
    'sectionIndex' => 1,
    'prompt' => 'Replace with a more energetic chorus',
    'callBackUrl' => 'https://soundstudiopro.com/callback.php'
];

echo "<h3>Request Parameters:</h3>";
echo "<pre>" . json_encode($replaceSectionParams, JSON_PRETTY_PRINT) . "</pre>";

try {
    $result = $api->replaceMusicSection($replaceSectionParams);
    echo "<h3>Response:</h3>";
    echo "<pre class='" . (isset($result['error']) ? 'error' : 'success') . "'>" . json_encode($result, JSON_PRETTY_PRINT) . "</pre>";
    
    if (isset($result['error'])) {
        echo "<p class='error'>โŒ Replace Section API Error: " . $result['error'] . "</p>";
    } else {
        echo "<p class='success'>โœ… Replace Section API call successful!</p>";
    }
} catch (Exception $e) {
    echo "<p class='error'>โŒ Exception: " . $e->getMessage() . "</p>";
}
echo "</div>";

// Test 4: Boost Style
echo "<div class='test-section'>";
echo "<h2>๐Ÿš€ Test 4: Boost Style API</h2>";
echo "<p class='endpoint'>Endpoint: POST /api/v1/style/generate</p>";

$boostStyleParams = [
    'content' => 'Pop, Mysterious', // Style description
    'audioUrl' => 'https://example.com/track.mp3', // Replace with actual URL
    'callBackUrl' => 'https://soundstudiopro.com/callback.php'
];

echo "<h3>Request Parameters:</h3>";
echo "<pre>" . json_encode($boostStyleParams, JSON_PRETTY_PRINT) . "</pre>";

try {
    $result = $api->boostMusicStyle($boostStyleParams);
    echo "<h3>Response:</h3>";
    echo "<pre class='" . (isset($result['error']) ? 'error' : 'success') . "'>" . json_encode($result, JSON_PRETTY_PRINT) . "</pre>";
    
    if (isset($result['error'])) {
        echo "<p class='error'>โŒ Boost Style API Error: " . $result['error'] . "</p>";
    } else {
        echo "<p class='success'>โœ… Boost Style API call successful!</p>";
    }
} catch (Exception $e) {
    echo "<p class='error'>โŒ Exception: " . $e->getMessage() . "</p>";
}
echo "</div>";

// Test 5: Generate Persona
echo "<div class='test-section'>";
echo "<h2>๐Ÿ‘ค Test 5: Generate Persona API</h2>";
echo "<p class='endpoint'>Endpoint: POST /api/v1/persona</p>";

$personaParams = [
    'name' => 'Test Persona',
    'description' => 'A test persona for API testing',
    'audioUrl' => 'https://example.com/reference.mp3', // Optional reference audio
    'callBackUrl' => 'https://soundstudiopro.com/callback.php'
];

echo "<h3>Request Parameters:</h3>";
echo "<pre>" . json_encode($personaParams, JSON_PRETTY_PRINT) . "</pre>";

try {
    $result = $api->generatePersona($personaParams);
    echo "<h3>Response:</h3>";
    echo "<pre class='" . (isset($result['error']) ? 'error' : 'success') . "'>" . json_encode($result, JSON_PRETTY_PRINT) . "</pre>";
    
    if (isset($result['error'])) {
        echo "<p class='error'>โŒ Generate Persona API Error: " . $result['error'] . "</p>";
    } else {
        echo "<p class='success'>โœ… Generate Persona API call successful!</p>";
    }
} catch (Exception $e) {
    echo "<p class='error'>โŒ Exception: " . $e->getMessage() . "</p>";
}
echo "</div>";

// Test 6: Get Credits
echo "<div class='test-section'>";
echo "<h2>๐Ÿ’ฐ Test 6: Get Remaining Credits</h2>";
echo "<p class='endpoint'>Endpoint: GET /api/v1/credits</p>";

try {
    $result = $api->getRemainingCredits();
    echo "<h3>Response:</h3>";
    echo "<pre class='" . (isset($result['error']) ? 'error' : 'success') . "'>" . json_encode($result, JSON_PRETTY_PRINT) . "</pre>";
    
    if (isset($result['error'])) {
        echo "<p class='error'>โŒ Get Credits API Error: " . $result['error'] . "</p>";
    } else {
        echo "<p class='success'>โœ… Get Credits API call successful!</p>";
        if (isset($result['credits']) || isset($result['data']['credits'])) {
            $credits = $result['credits'] ?? $result['data']['credits'];
            echo "<p class='info'>Remaining Credits: $credits</p>";
        }
    }
} catch (Exception $e) {
    echo "<p class='error'>โŒ Exception: " . $e->getMessage() . "</p>";
}
echo "</div>";

echo "<hr>";
echo "<h2>๐Ÿ“ Notes:</h2>";
echo "<ul>";
echo "<li>Replace example URLs with actual audio file URLs for real testing</li>";
echo "<li>Check callback.php logs to see if callbacks are received</li>";
echo "<li>Verify task IDs are stored correctly in the database</li>";
echo "<li>Test with actual user accounts to verify credit deduction</li>";
echo "</ul>";
?>


CasperSecurity Mini