[ 'playlistId' => $playlistId, 'resourceId' => [ 'kind' => 'youtube#video', 'videoId' => $videoId ] ] ]; $ch = curl_init('https://www.googleapis.com/youtube/v3/playlistItems?part=snippet'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $token['access_token'], 'Content-Type: application/json', 'User-Agent: curl/7.64.1' ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postData)); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true); if (isset($result['id'])) { echo "✅ Added video to FediList: $videoId\n"; return true; } else { echo "‼️ Failed to add video:\n$response\n"; return false; } } ?>