23 mars 2016

[UNIX/LINUX] exemples requêtes curl

Source : http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request

With fields:

curl --data "param1=value1&param2=value2" https://example.com/resource.cgi
Multipart:
curl --form "fileupload=@my-file.txt" https://example.com/resource.cgi
Multipart 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.cgi
Without data:
curl --data '' https://example.com/resource.cgi

curl -X POST https://example.com/resource.cgi

curl --request POST https://example.com/resource.cgi
For more information see the cURL manual. The cURL tutorial on emulating a web browser is helpful.

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 \
  http://example.com/resource.cgi
The -o output is required, otherwise no progress bar will appear.

Aucun commentaire:

Enregistrer un commentaire

Différences majeures entre Red Hat 6, 7, 8 et 9

Quelles sont les différences majeures entre RHEL 6, 7, 8 et 9 ? Système de fichiers RHEL 6: Par défaut : ext4. Autres : ext2, ext3 supportés...