I'm able to download data from a database as a .xls file thanks to a nice tutorial here , the essence of which is using headers:
header("Content-Type: application/vnd.ms-excel");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
/* And to give the user that "open or save" dialog box, simply add the line between the PHP tags: */
header("content-disposition: attachment;filename=yourFileName.xls");
If I try to run the page as a cronjob, I only get the data on the page (ie. a table of html) - I would like to get the .xls as an email attachment.
Anyone know of a way to get the data emailed as an attachment with a cronjob or is there a better way of approaching this?