curl is a command-line tool that sends network requests, then retrieves and extracts data and shows it on "standard output" (stdout). We in technical support use it a lot in our daily work, so here's a quick introduction to some common uses
1. Inspect a resource's headers
curl -I http://upfiles.b0.upaiyun.com/logo/90x45.png -v
-I returns the response headers only (Show document info only)
-i returns the entire content, including the body
-v shows the whole request/response process, without the body
2. Get a response with specified request headers
curl -I -H "origin:" http://upfiles.b0.upaiyun.com/logo/90x45.png -v
-H sets request headers for this request. For example, to check whether the server supports CORS, send origin: with the request, and the response will return Access-Control-Allow-Origin: *
3. Inspect a file's headers on a specific IP
curl -I -H "host:upfiles.b0.upaiyun.com" 60.190.249.102/logo/90x45.png
-H sets request headers for this request. This requests the resource from the node at the IP starting with 60, similar to binding hosts in a browser
4. Download a file
curl -o /dev/null http://upfiles.b0.upaiyun.com/logo/90x45.png -v
-o downloads the file
/dev/null is like the system's trash can: things go in but are never kept
5. Download a file from a specific IP, similar to #3
curl -o -H "host:upfiles.b0.upaiyun.com" 60.190.249.102/logo/90x45.png
6. Upload a file
curl -T localpath http://v0.api.upyun.com/bucket/upyun_path -u operator:password
-T means transfer FILE to destination
localpath is the local file path
destination is the cloud storage path
-u user USER[:PASSWORD] Server user and password
