With fields:
curl --data "param1=value1¶m2=value2" https://example.com/resource.cgiMultipart:
curl --form "fileupload=@my-file.txt" https://example.com/resource.cgiMultipart with fields and a filename:
curl --form "fileupload=@my-file.txt;filename=desired-filename.txt" --form param1=value1 --form param2=value2 https://example.com/resource.cgiWithout data:
curl --data '' https://example.com/resource.cgiFor more information see the cURL manual. The cURL tutorial on emulating a web browser is helpful.
curl -X POST https://example.com/resource.cgi
curl --request POST https://example.com/resource.cgi
With libcurl, use the curl_formadd() function to build your form before submitting it in the usual way. See the libcurl documentation for more information.
For large files, consider adding parameters to show upload progress:
curl --tr-encoding -X POST -v -# -o output -T filename.dat \The -o output is required, otherwise no progress bar will appear.
http://example.com/resource.cgi
Aucun commentaire:
Enregistrer un commentaire