get('https://api.spotify.com/v1/me/playlists', [
'headers' => ['Authorization' => "Bearer $spotifyToken"]
]);
$playlists = json_decode($response->getBody(), true);
foreach ($playlists['items'] as $playlist) {
echo "Übertrage Playlist: " . $playlist['name'] . "
";
// Implementiere die Logik, um die Playlist nach Tidal zu übertragen
echo "Playlist " . $playlist['name'] . " erfolgreich übertragen.
";
}
echo "Alle Playlists erfolgreich übertragen!";
}
// Hauptlogik
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$spotifyClientId = $_POST['spotify_client_id'];
$spotifyClientSecret = $_POST['spotify_client_secret'];
$tidalUsername = $_POST['tidal_username'];
$tidalPassword = $_POST['tidal_password'];
$spotifyToken = getSpotifyToken($spotifyClientId, $spotifyClientSecret, 'http://localhost/callback');
transferPlaylists($spotifyToken, $tidalUsername, $tidalPassword);
}
?>