curl to file code example

Example 1: curl output to a file

curl http://www.mysite.com -o myoutputfile.txt

Example 2: curl html file

curl -o thatpage.html http://www.example.com/

Example 3: how to download using curl

curl http://some.url --output some.file

Example 4: download a file using curl

$  curl -o taglist.zip http://www.vim.org/scripts/download_script.php?src_id=7701
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 50243  100 50243    0     0   170k      0 --:--:-- --:--:-- --:--:--  400k

Example 5: curl download file without output

curl -O https://www.cyberciti.biz/files/sticker/sticker_book.pdf

Example 6: curl data from file

curl -i -X POST host:port/post-file \
  -H "Content-Type: text/xml" \
  --data-binary "@path/to/file"