KIM COMPUTER


curl (Client URL)

curl is a command-line tool used to transfer data to or from a server. It supports a wide range of protocols, including HTTP, HTTPS, FTP, and more. It is widely used for testing APIs, automation scripts, and downloading web content directly from the terminal.


1. Basic Usage

curl [options] [URL]

2. Key Options

Option Name Description
-O Remote Name Saves the output to a file named after the remote file.
-o [file] Output Saves the output to a specific filename.
-L Location Follows any redirects (301, 302 errors).
-I Head Fetches the HTTP-header only.
-X [method] Request Specifies a custom request method (GET, POST, etc.) for communicating with the server.
-d [data] Data Sends the specified data in a POST request.

3. Practical Examples

① Downloading a file

curl -L -O https://github.com/user/repo/archive/master.zip

② Testing an API with a GET request

curl https://api.weather.com/v1/forecast

③ Sending a POST request with headers

curl -H "Authorization: Bearer YOUR_TOKEN" -X POST -d "param1=value1" https://api.myservice.com/data

4. [Tip] Troubleshooting

If a curl command seems to do nothing, try adding -v (verbose). It will show the entire handshake, headers, and any errors occurring during the connection process.