cURL Tutorial

created: 2023/1/23

 

cURL basic usage
 
curl <url>
Downloading Files with cURL
-o, --output <file>
curl -o vlc.dmg http://ftp.belnet.be/mirror/videolan/vlc/3.0.4/macosx/vlc-3.0.4.dmg
-O, --remote-name
curl -O http://ftp.belnet.be/mirror/videolan/vlc/3.0.4/macosx/vlc-3.0.4.dmg

Bear in mind that when you use the -o or the -O options and a file of the same name exists, cURL will overwrite it.

-C, --continue-at <offset>
curl -O -C - http://ftp.belnet.be/mirror/videolan/vlc/3.0.4/macosx/vlc-3.0.4.dmg

Use "-C -" to tell curl to automatically find out where/how to resume the transfer. 

 

Like most other command line tools, you can combine different options together. For example, in the above command, you could combine -O -C - and write it as -OC -

   
Anatomy of a HTTP request/response
   
   
   
   
   
   
Following redirects with cURL
   
   
   
   
   
   
Viewing response headers with cURL
   
   
   
   
   
   
Viewing request headers and connection details
   
   
   
   
   
   
Silencing errors
   
   
   
   
   
   
Setting HTTP request headers with cURL
   
   
   
   
   
   
Making POST requests with cURL
   
   
   
   
   
   
Submitting JSON data with cURL
   
   
   
   
   
   
Changing the request method
   
   
   
   
   
   
Replicating browser requests with cURL
   
   
   
   
   
   
Making cURL fail on HTTP errors
   
   
   
   
   
   
Making authenticated requests with cURL
   
   
   
   
   
   
Testing protocol support with cURL
   
   
   
   
   
   
Setting the Host header and cURL’s --resolve option
   
   
   
   
   
   
Resolve domains to IPv4 and IPv6 addresses
   
   
   
   
   
   
Disabling cURL’s certificate checks
   
   
   
   
   
   
Troubleshooting website issues with “cURL timing breakdown”
   
   
   
   
   
   
cURL configuration files
   
   
   
   
   
   
Conclusion
   
   
   
   
   
   
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章