Put this code below your loop.
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="pedidos.csv"');
echo $shtml;
How did you find out the content type application/force-download? I’ve never heard of it. The proper MIME type for CSV is text/csv
You can find more examples how to use header function in php manual
You need also display $shtml
you didn’t do it in your code.