D
D
Dmitry Skogorev2015-11-17 00:51:05
PHP
Dmitry Skogorev, 2015-11-17 00:51:05

How to send a file to curl?

Good day, it is required to transfer the file as one of the parameters
, now I use it like this

curl_setopt($curl, CURLOPT_POSTFIELDS, array(..., 'myfile' => '@test.csv'));

if I'm not mistaken, since php 5.5 this feature has been removed,
so the question is: how to transfer a file in the most kosher way, and generally transfer your text string (variable) as a file, without pulling the file system.
Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2015-11-17
@dimonchik2013

stackoverflow.com/questions/4223977/send-file-via-...
there is also a string-file, but I can’t find it right away,
see
stackoverflow.com/questions/3007253/send-post-xml-...
and here is the second answer
stackoverflow.com/questions/12667797/using-curl-to...
the main idea is the correct header, firstly - multipart, secondly - I don't remember the exact size , but it seems that the size includes all the POST data, not just the check
file
simple - www.telerik.com/fiddler for help

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question