I'm trying to allow users to download a CSV of a database query on my Wordpress site. It's not just a download of a static file, the query is based off of the user that is logged in and the page they are viewing, so a lot of the download management plugins are no good as just allow a specific file for download. This file is not generated until the user does something.
I've made a web service that is able to correctly format and generate the file, but I can't figure out how to serve it up for download. Right now, the download button just goes to the web service's page. The PHP error says,
"Cannot modify header information. Headers already sent by (long path to the location of the web service)"