Difference between revisions of "Linux curl"
From John Freier
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | == Resources == | ||
+ | http://man.cx/curl | ||
+ | |||
== Download File == | == Download File == | ||
To download a file using curl add the -O option. | To download a file using curl add the -O option. | ||
Line 4: | Line 7: | ||
curl -O http://example.com/file.txt | curl -O http://example.com/file.txt | ||
− | + | == POST == | |
To post data with headers | To post data with headers | ||
-v verbose | -v verbose | ||
Line 12: | Line 15: | ||
-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:"" | + | curl -v -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST http://example.com/item/1 -d '{"text":"","data":""}' |
Latest revision as of 12:21, 18 April 2016
Resources
Download File
To download a file using curl add the -O option.
curl -O http://example.com/file.txt
POST
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":""}'