Answer the question
In order to leave comments, you need to log in
How to generate a CSV file and send it as a POST request without saving it?
Hello!
Tell me how to generate a CSV file and send it with a POST request without saving it?
How to generate is clear, but how to send the generated data via Guzzle or Http Client to Laravel without saving the file?
Answer the question
In order to leave comments, you need to log in
You can send a file to guzzle using multipart
https://docs.guzzlephp.org/en/stable/request-optio...
while the contents of the file itself can be a string: parametercontents
$csv_data = 'xxxx;yyy;zzz';
$client->request('POST', '/post', [
'multipart' => [
[
'name' => 'mycsv',
'contents' => $csv_data,
'filename' => 'custom_filename.csv'
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question