The curl command is a file transfer tool that works from the command line using URL rules. It supports uploading and downloading of files. curl supports many protocols including HTTP, HTTPS, ftp, etc. It also supports POST, cookies, authentication, downloading partial files from a specified offset, user agent string, speed limit, file size, progress bar and other features.
In the process of developing and testing web background programs, it is often necessary to send urls for testing. Using curl can easily simulate url commands that meet the requirements.
Suppose the target url is: 127.0.0.1:8080/login
Send a GET request with curl: curl protocol://address:port/url?args
- curl http://127.0.0.1:8080/login?admin&passwd=12345678
- curl -d "user=admin&passwd=12345678" http://127.0.0.1:8080/login
curl -H "Content-Type:application/json" -X POST -d 'json data' URL
- curl -H "Content-Type:application/json" -X POST -d '{"user": "admin", "passwd":"12345678"}' http://127.0.0.1:8000/login