I am creating an Excel file dynamically(data coming from database). on calling the URL it works fine it shows the download dialog box. but i want to save this file in a folder(i.e in my servers harddisk) dynamically whenever i call this URL using CURl function.
How can i set the headers in such a way that it will create the Excel file and save it in a folder.
The header code that i am using,
<?php
$name = "myFile";
$file_ending = "xls";
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename={$name}.{$file_ending}");
header("Pragma: no-cache");
header("Expires: 0");
echo "the data...";
?>
or is there any other method to do so.
NOTE-I want it this way because, this function will be called by the web servers scheduler.
You cannot save something in some specific path by setting headers. HTTP headers specifically only help transport data across an HTTP network connection, which knows nothing of file systems.
Perhaps you just want to write the data into a file instead?