All pastes #819566 Raw Edit

Someone

public text v1 · immutable
·published 2007-12-17 01:34 UTC
rendered paste body
<?php

header("Content-type: application/octet-stream"); 
header("Content-Disposition: attachment; filename=GiftsFaith-OutofStock.xls"); 
header("Pragma: no-cache"); 
header("Expires: 0");

$tab = "\t";
$cr = "\n";

$SKU = 'hi';
$Name = 'My Nmae';
$Availability = 'Out of Stock';
$URL = 'http://www.google.com';

$data = "SKU" . $tab . "Name" . $tab . "Availability" . $tab . "URL" . $cr;
$data .= $SKU . $tab . $Name . $tab . $Availability . $tab . $URL . $cr;

$fp = fopen($filename,"a"); // $fp is now the file pointer to file $filename
if($fp){
    fwrite($fp,$data);    //    Write information to the file
    fclose($fp);  //    Close the file
    echo "File saved successfully";
} else {
    echo "Error saving file!";
}
 

echo $data;

?>