I thought it will be easy task, but simple I'm not able to output data from an array to CSV file (saved on a server).
Code for that part looks like:
$fp = fopen('missing-skus.csv', 'w');
foreach ($missing_array as $lines) {
    fputcsv($fp, $lines);
}
fclose($fp);
$missing_array looks like:
Array
(
    [0] => 5804
    [1] => 5803
    [2] => 5802
    [3] => 5801
    [4] => 5800
    [5] => 5799
    [6] => 5798
    [7] => 5797
    [8] => 5796
    [9] => 5795
    [10] => 5794
    [11] => 5793
    [12] => 5792
    [13] => 5791
    [14] => 5790
    [15] => 5789
    [16] => 5788
    [17] => 5787
    [18] => 5786
    [19] => 5785
    [20] => 5784
    [21] => 5783
    [22] => 5782
    [23] => 5781
    [24] => 5780
    [25] => 5779
)
No matter what, file is always blank. Any clue what I have missed?


'php://output'as the filename to output to the browser as a test.fputscsvis an array of fileds. You are passing a string or int.fputcsv($fp, array($lines));. The second param should be an array, even if you only have 1 column.