![]() 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
require_once 'config/database.php';
$pdo = getDBConnection();
echo "<h2>Regenerating 'Happy Song For Andrew' Track</h2>";
// Find the track with temporary task ID
$stmt = $pdo->prepare("
SELECT * FROM music_tracks
WHERE title = 'Happy Song For Andrew' AND task_id LIKE 'temp_%'
ORDER BY created_at DESC
");
$stmt->execute();
$track = $stmt->fetch();
if (!$track) {
echo "<p style='color: red;'>❌ Track not found or already has proper task ID</p>";
exit;
}
echo "<h3>Found Track: " . htmlspecialchars($track['title']) . " (ID: " . $track['id'] . ")</h3>";
echo "<p>Current Task ID: " . $track['task_id'] . "</p>";
echo "<p>Prompt: " . htmlspecialchars($track['prompt']) . "</p>";
echo "<p>Model: " . $track['model_version'] . "</p>";
// API.Box configuration
$api_key = '63edba40620216c5aa2c04240ac41dbd';
$api_url = 'https://api.api.box/api/v1/generate';
// Prepare the request data
$request_data = [
'prompt' => $track['prompt'],
'model' => 'V4_5', // Use the latest model
'style' => 'Pop',
'title' => $track['title'],
'duration' => 30,
'callBackUrl' => 'https://soundstudiopro.com/callback.php'
];
echo "<p>Submitting to API.Box...</p>";
// Make the API request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($request_data));
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_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "<p>API Response Code: $http_code</p>";
echo "<p>API Response: " . htmlspecialchars($response) . "</p>";
if ($http_code === 200) {
$response_data = json_decode($response, true);
if ($response_data && isset($response_data['data']['task_id'])) {
$new_task_id = $response_data['data']['task_id'];
echo "<p style='color: green;'>✅ Success! New Task ID: $new_task_id</p>";
// Update the track with the new task ID
$stmt = $pdo->prepare("
UPDATE music_tracks
SET task_id = ?, status = 'processing', updated_at = CURRENT_TIMESTAMP
WHERE id = ?
");
if ($stmt->execute([$new_task_id, $track['id']])) {
echo "<p style='color: green;'>✅ Track updated with new Task ID!</p>";
echo "<p>Track ID: " . $track['id'] . "</p>";
echo "<p>New Task ID: $new_task_id</p>";
echo "<p>Status: processing</p>";
} else {
echo "<p style='color: red;'>❌ Failed to update track in database</p>";
}
} else {
echo "<p style='color: red;'>❌ Invalid response format</p>";
}
} else {
echo "<p style='color: red;'>❌ API request failed</p>";
}
echo "<h3>✅ Regeneration Complete!</h3>";
echo "<p>The track is now being processed by API.Box with a proper task ID.</p>";
echo "<p>Check back in a few minutes - it should complete automatically!</p>";
?>