Difference between revisions of "Linux curl"

From John Freier
Jump to: navigation, search
Line 10: Line 10:
 
  -H extra header information
 
  -H extra header information
 
  -X type of request
 
  -X type of request
  -d data  
+
  -d data
 +
 
 
   curl -v -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST http://example.com/item/1 -d '{text:""},{data:""}'
 
   curl -v -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST http://example.com/item/1 -d '{text:""},{data:""}'

Revision as of 12:42, 18 April 2016

Download File

To download a file using curl add the -O option.

 curl -O http://example.com/file.txt


To post data with headers

-v verbose
-i include header information on output
-H extra header information
-X type of request
-d data
 curl -v -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST http://example.com/item/1 -d '{text:""},{data:""}'