but now I need write a script (I think few lines in this acc.php file) which will let me download a CSV file..
I am not proffesional PHP programer and I never wrote a script which make a file..
help me please..

Moderators: macek, egami, gesf


header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="filename_user_will_see_when_try_to_download.csv"'); mamandis wrote: a script which all data from my partners I get prints to a screen



$FileName = date("y-m-d") . '.csv';
function maybeEncodeCSVField($Content) {
if(strpos($Content, ',') !== false || strpos($Content, '"') !== false || strpos($Content, "\n") !== false) {
$Content = '"' . str_replace('"', '""', $Content) . '"';
}
return $Content;
}
# Titlte of the CSV
$Content = "Name,Address,Age,Phone \n";
# fill data in the CSV
$Content .= $GetProductListRequest;
header('Content-Type: application/csv');
header("Content-length: " . filesize($NewFile));
header('Content-Disposition: attachment; filename="' . $FileName . '"');
echo $Content;
exit(); 



As you asked.
Users browsing this forum: No registered users and 1 guest