Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
fuss:curl [2018/06/14 18:48] officefuss:curl [2025/01/28 19:29] (current) – [Download a File to the Current Directory] office
Line 1: Line 1:
 +====== Make a POST Request with From Data Contained Within a File ======
 +
 +<code bash>
 +curl -v --data @payload.txt -H "Content-Type: application/x-www-form-urlencoded" -X POST http://server:8080
 +</code>
 +
 +where ''payload.txt'' contains key-value pairs.
 +
 +
 ====== Send a Compressed Request ====== ====== Send a Compressed Request ======
  
Line 12: Line 21:
 The command will create a compressed file ''request.txt.gz''. Afterward, the ''curl'' command shall read: The command will create a compressed file ''request.txt.gz''. Afterward, the ''curl'' command shall read:
 <code bash> <code bash>
-curl -v --data-binary @request.txt.gz "Content-Type: application/x-www-url-form-urlencoded" -H "Content-Encoding: gzip" -X POST http://server.tld/+curl -v --data-binary @request.txt.gz "Content-Type: application/x-www-form-urlencoded" -H "Content-Encoding: gzip" -X POST http://server.tld/
 </code> </code>
 where: where:
   * ''-v'' turns on verbosity,   * ''-v'' turns on verbosity,
   * ''--data-binary @request.txt.gz'' will send the ''request.txt.gz'' file as the request body (mind the ''@'', it is necessary),   * ''--data-binary @request.txt.gz'' will send the ''request.txt.gz'' file as the request body (mind the ''@'', it is necessary),
-  * the request ''Content-Type'' is set to ''application/x-www-url-form-urlencoded'' indicating that the ''request.txt.gz'' file contains POST key-value data,+  * the request ''Content-Type'' is set to ''application/x-www-form-urlencoded'' indicating that the ''request.txt.gz'' file contains POST key-value data,
   * the request ''Content-Encoding'' is set to ''gzip'',   * the request ''Content-Encoding'' is set to ''gzip'',
   * the request will be sent to ''<nowiki>http://server.tld/</nowiki>''   * the request will be sent to ''<nowiki>http://server.tld/</nowiki>''
 +
 +====== Download a File to the Current Directory ======
 +
 +^ Command Line Aspect ^ Visual Mnemonic Graft ^
 +| ''-fLOsS'' | {{fuss:fuss_curl_ideogram_mnemonic_floss.png?nolink&128}} |
 +
 +The following command:
 +<code bash>
 +curl -fLOsS https://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2024.9.1_all.deb
 +</code>
 +will download the binary file ''deb-multimedia-keyring_2024.9.1_all.deb'' to the current directory by using ''fLOsS'' as command-line parameters passed to ''curl''.
 +
 +The parameters ''-fLOsS'' carry the following meaning:
 +  * ''-f'' makes curl fail in case there are errors and to not output any document,
 +  * ''-L'' means to follow any redirects,
 +  * ''-O'' tells curl to save the the body to the current directory,
 +  * ''-s'' makes curl silent,
 +  * ''-S'' makes curl show an error in case the download fails (this combines with ''-s'', as in, be silent if no fail)
 +
  

fuss/curl.1529002139.txt.gz · Last modified: 2018/06/14 18:48 by office

Wizardry and Steamworks

© 2025 Wizardry and Steamworks

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.