Hello guys,
Had a special request to trim the csv fields in the file.
After searching, found a code to satisfy the request.
Posted the URL from the original link
Enjoy,
Coffee Cup
http://stackoverflow.com/questions/8608970/writing-to-csv-using-fgetcsv
$input = 'input.txt';
$output = 'output.txt';
if (false !== ($ih = fopen($input, 'r'))) {
$oh = fopen($output, 'w');
while (false !== ($data = fgetcsv($ih))) {
// this is where you build your new row
$outputData = array($data[0], $data[1], $data[4], $data[5], $data[6]);
fputcsv($oh, $outputData);
}
fclose($ih);
fclose($oh);
}